Skip to content

Instantly share code, notes, and snippets.

@martin-honnen
Created July 16, 2023 11:14
Show Gist options
  • Select an option

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

Select an option

Save martin-honnen/b6c4ec7e5f0b7f3ea3e550890a329dd4 to your computer and use it in GitHub Desktop.
Stylesheet module resolution for XSLT 3 fiddle using Gist files as input
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:mode on-no-match="shallow-copy"/>
</xsl:stylesheet>
<root>
<text>This is a test.</text>
</root>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:import href="module1.xsl"/>
<xsl:template match="/" name="xsl:initial-template">
<xsl:copy>
<xsl:apply-templates/>
<xsl:comment>Run with processor {system-property('xsl:product-name')} {system-property('xsl:product-version')} and file {static-base-uri()} at {current-dateTime()}</xsl:comment>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
{"N":"package","version":"30","packageVersion":"1","saxonVersion":"SaxonJS 2.5","target":"JS","targetVersion":"2","name":"TOP-LEVEL","relocatable":"true","buildDateTime":"2023-07-16T13:15:41.742+02:00","ns":"xml=~ xsl=~ xs=~","C":[{"N":"co","id":"0","uniform":"true","binds":"1","C":[{"N":"template","flags":"os","module":"sheet1.xsl","slots":"200","name":"Q{http://www.w3.org/1999/XSL/Transform}initial-template","line":"10","expand-text":"true","sType":"1 ","C":[{"N":"copy","sType":"1 ","flags":"cin","role":"body","line":"11","C":[{"N":"sequence","sType":"* ","C":[{"N":"applyT","sType":"* ","line":"12","mode":"#unnamed","bSlot":"0","C":[{"N":"docOrder","sType":"*N u[NT,NP,NC,NE]","role":"select","line":"12","C":[{"N":"slash","role":"select","simple":"1","sType":"*N u[NT,NP,NC,NE]","C":[{"N":"treat","as":"N","diag":"13|0|XTTE0510|","C":[{"N":"dot"}]},{"N":"axis","name":"child","nodeTest":"*N u[NT,NP,NC,NE]","sType":"*N u[NT,NP,NC,NE]","ns":"= xml=~ fn=~ xsl=~ xs=~ "}]}]}]},{"N":"comment","sType":"1NC ","C":[{"N":"fn","name":"string-join","role":"select","C":[{"N":"forEach","sType":"*AS ","C":[{"N":"data","sType":"*A ","C":[{"N":"mergeAdj","C":[{"N":"valueOf","sType":"1NT ","C":[{"N":"fn","name":"string-join","C":[{"N":"sequence","sType":"*AS ","C":[{"N":"str","sType":"1AS ","val":"Run with processor "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AS","C":[{"N":"fn","name":"system-property","sType":"1AS","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13","C":[{"N":"str","val":"xsl:product-name"}]}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AS","C":[{"N":"fn","name":"system-property","sType":"1AS","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13","C":[{"N":"str","val":"xsl:product-version"}]}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" and file "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"?AU","C":[{"N":"fn","name":"static-base-uri","sType":"?AU","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13"}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" at "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AMP","C":[{"N":"fn","name":"current-dateTime","sType":"1AMP","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13"}]}]}]},{"N":"str","sType":"1AS ","val":" "}]}]},{"N":"str","sType":"1AS ","val":""}]}]}]}]},{"N":"fn","name":"string","sType":"1AS ","C":[{"N":"dot"}]}]},{"N":"str","sType":"1AS ","val":" "}]}]}]}]}]}]},{"N":"co","id":"1","binds":"1","C":[{"N":"mode","onNo":"SC","flags":"","patternSlots":"0","prec":"","C":[{"N":"templateRule","rank":"0","prec":"1","seq":"0","ns":"xml=~ xsl=~ xs=~","minImp":"0","flags":"s","slots":"200","line":"10","module":"sheet1.xsl","expand-text":"true","match":"/","prio":"-0.5","matches":"ND","C":[{"N":"p.nodeTest","role":"match","test":"ND","sType":"1ND","ns":"= xml=~ fn=~ xsl=~ xs=~ "},{"N":"copy","sType":"1ND ","flags":"cin","role":"action","line":"11","C":[{"N":"sequence","sType":"* ","C":[{"N":"applyT","sType":"* ","line":"12","mode":"#unnamed","bSlot":"0","C":[{"N":"axis","name":"child","nodeTest":"*N u[NT,NP,NC,NE]","sType":"*N u[NT,NP,NC,NE]","ns":"= xml=~ fn=~ xsl=~ xs=~ ","role":"select","line":"12"}]},{"N":"comment","sType":"1NC ","C":[{"N":"fn","name":"string-join","role":"select","C":[{"N":"forEach","sType":"*AS ","C":[{"N":"data","sType":"*A ","C":[{"N":"mergeAdj","C":[{"N":"valueOf","sType":"1NT ","C":[{"N":"fn","name":"string-join","C":[{"N":"sequence","sType":"*AS ","C":[{"N":"str","sType":"1AS ","val":"Run with processor "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AS","C":[{"N":"fn","name":"system-property","sType":"1AS","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13","C":[{"N":"str","val":"xsl:product-name"}]}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AS","C":[{"N":"fn","name":"system-property","sType":"1AS","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13","C":[{"N":"str","val":"xsl:product-version"}]}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" and file "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"?AU","C":[{"N":"fn","name":"static-base-uri","sType":"?AU","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13"}]}]}]},{"N":"str","sType":"1AS ","val":" "}]},{"N":"str","sType":"1AS ","val":" at "},{"N":"fn","name":"string-join","sType":"1AS ","C":[{"N":"convert","type":"AS*","from":"AZ","to":"AS","C":[{"N":"data","C":[{"N":"mergeAdj","sType":"1AMP","C":[{"N":"fn","name":"current-dateTime","sType":"1AMP","ns":"= xml=~ fn=~ xsl=~ xs=~ ","line":"13"}]}]}]},{"N":"str","sType":"1AS ","val":" "}]}]},{"N":"str","sType":"1AS ","val":""}]}]}]}]},{"N":"fn","name":"string","sType":"1AS ","C":[{"N":"dot"}]}]},{"N":"str","sType":"1AS ","val":" "}]}]}]}]}]}]}]},{"N":"overridden"},{"N":"output","C":[{"N":"property","name":"Q{http://saxon.sf.net/}stylesheet-version","value":"30"}]},{"N":"decimalFormat"}],"Σ":"c8cc82bf"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment