Skip to content

Instantly share code, notes, and snippets.

View sardinecan's full-sized avatar

Josselin Morvan sardinecan

View GitHub Profile
@sardinecan
sardinecan / formxpr
Created March 27, 2019 15:34
Sardinecan's Xforms
<xf:group
ref="instance('objects')">
<xf:select
ref="object"
appearance="full">
<!--@bug il existe l'attribut selection="open" pour ces cas mais il ne semble pas fonctionner. Il permet de préciser une valeur qui ne serait pas dans la liste.-->
<!-- https://sourceforge.net/p/xsltforms/mailman/message/24465876/ -->
<xf:label>Objet de l'expertise</xf:label>
<xf:item>
<xf:label>Maison</xf:label>
@sardinecan
sardinecan / gist:eec92d71de0f76952b31a64a3a096c14
Created April 10, 2019 13:03
Repeat with external instances
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<meta
charset="UTF-8"/>
<title>Copy Item</title>
<xf:model>
<xf:instance
@sardinecan
sardinecan / xformsTestNamespace
Created April 12, 2019 15:46
Xforms : instance avec espace de nom
declare
%rest:path("/testNamespace")
%output:method("xml")
function test() {
(processing-instruction xml-stylesheet {'href="static/xsltforms/xsltforms/xsltforms.xsl"', 'type="text/xsl"'},
processing-instruction css-conversion {'no'},
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="hasChild selector with JS">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.color {
color:red;
@sardinecan
sardinecan / index.html
Last active May 3, 2019 12:09
Button cross/close - pure CSS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
button {
position:relative;
border:0;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.delete {
display:flex;
-webkit-mask: url(https://cdn.worldvectorlogo.com/logos/react.svg) 50% 50%;
@sardinecan
sardinecan / data import when loading form
Created June 16, 2019 11:53
Récupétation de données au chargement du formulaire à partir d'une autre instance
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>XForms inputs with labels</title>
<xf:model>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('empty')/fullName" value="concat(instance('prefilled')/forename, ' ', instance('prefilled')/surname)"/>
</xf:action>
<xf:instance id="prefilled">
@sardinecan
sardinecan / mixed content
Created July 7, 2020 10:12
tokenize/regex mixed xml content
xquery version "3.1";
let $map := map {
"method": "xml",
"version": "1.0",
"indent": true(),
"use-character-maps": map {
"&lt;":"&lt;",
"&gt;":"&gt;"
}
}
@sardinecan
sardinecan / Wrap nodes between two different tags
Last active July 10, 2020 21:38
Wrap nodes between two different tags
<?xml version="1.0" encoding="UTF-8"?>
<test>
<p>
Ici un texte contenant une <noteAncre>note
<span>encadrée</span> par une ancre de début et de fin</noteAncre>.
Puis, pour la forme, <noteAncre2>une seconde note</noteAncre2>
</p>
</test>
<?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:foo="foo" foo:bogus="ff fix">
<head>
<title>Rock with XForms !</title>
<xf:model>
<xf:instance id="music">
<data xmlns="foo">
<rockBand/>
<album n="1"/>
<album n="2"/>