Skip to content

Instantly share code, notes, and snippets.

@bmix
bmix / sample.xml
Last active October 30, 2023 11:05
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./xml.css"?>
<!--
Sample XML File (light version)
@version 0.1.0-exp
@date 2019-07-14
@author Andreas Mixich
@license CC0 or, where local legislature does not respect PublicDomain, ISC.
Expression Utility Objects
Besides these basic objects, Thymeleaf will offer us a set of utility objects that will help us perform common tasks in our expressions.
#dates: utility methods for java.util.Date objects: formatting, component extraction, etc.
#calendars: analogous to #dates, but for java.util.Calendar objects.
#numbers: utility methods for formatting numeric objects.
#strings: utility methods for String objects: contains, startsWith, prepending/appending, etc.
#objects: utility methods for objects in general.
#bools: utility methods for boolean evaluation.
#arrays: utility methods for arrays.
@bmix
bmix / xqdoc-to-markdown.xq
Created August 22, 2020 23:01 — forked from duncdrum/xqdoc-to-markdown.xq
create function documentation in markdown based on xqDoc annotations
xquery version "3.1";
(:~
: This module generates the function documentation for the xQuery modules, in the context of eXist-db.
:
: @author Duncan Paterson
: @version 0.7
:
: @return func-doc.md:)
@bmix
bmix / xsl-choose-vs-xpath
Created June 24, 2020 21:34 — forked from emiliano-poggi/xsl-choose-vs-xpath
XSLT 1.0 xsl:choose vs. XPath
$a | self::node()[$a]
can stay for:
<xsl:choose>
<xsl:when test="$a">
<xsl:value-of select="$a"/>
</xsl:when>
<xsl:otherwise>
<xsl:template name="split">
<xsl:param name="text"/>
<xsl:param name="by"/>
<xsl:param name="normalize" select="false()"/>
<xsl:variable name="l" select="substring-before($string, $by)"/>
<xsl:variable name="r" select="substring-after($string, $by)"/>
<xsl:choose>
<xsl:when test="$l and $normalize">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:include href="identity.xsl"/>
<xsl:template match="/*/child"/>
<xsl:template match="/*/parent">
<xsl:variable name="A"
select="
following-sibling::parent[1]/preceding-sibling::*
@bmix
bmix / local-identity.xsl
Created June 24, 2020 21:33 — forked from emiliano-poggi/local-identity.xsl
XSLT: "local" identity
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()[not(self::*)]">
<xsl:copy/>
</xsl:template>
<xsl:template match="*">
@bmix
bmix / identity-ns-bypass.xsl
Created June 24, 2020 21:33 — forked from emiliano-poggi/identity-ns-bypass.xsl
XSLT: Bypassing elements of a given namespace
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="http://s1">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
@bmix
bmix / identity-variant-1.xsl
Created June 24, 2020 21:32 — forked from emiliano-poggi/identity-variant-1.xsl
XSLT: identity transform
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--processes all *elements* by copying them, and can be overridden for individual elements -->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
@bmix
bmix / sample-input.xml
Created June 24, 2020 21:32 — forked from emiliano-poggi/sample-input.xml
XSLT: Split list in tokens
<root>
<varlist>a.a.a b.b.b c.c.c</varlist>
</root>