Skip to content

Instantly share code, notes, and snippets.

@martin-honnen
Last active August 7, 2023 13:30
Show Gist options
  • Select an option

  • Save martin-honnen/00fdd29c6a33584251ecf205987b4b1d to your computer and use it in GitHub Desktop.

Select an option

Save martin-honnen/00fdd29c6a33584251ecf205987b4b1d to your computer and use it in GitHub Desktop.
XSLT document('') test in Gist code
<root>
<item>
<value>a</value>
</item>
<item>
<value>b</value>
</item>
</root>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:data="http://example.com/mh/data"
expand-text="yes"
exclude-result-prefixes="data">
<data:data>
<map key="a">1</map>
<map key="b">2</map>
</data:data>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:template match="item/value">
<xsl:copy>{document('')/xsl:stylesheet/data:data/map[@key = current()]}</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment