Project

Profile

Help

Bug #6419 » MatchUnionTest.xslt

Stylesheet - Adrian Bird, 2024-05-10 09:01

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- variable with both nodeA and nodeB at the lowest level -->
<xsl:variable name="multiNodes">
<nodes>
<nodeA>A</nodeA>
<nodeB>B</nodeB>
<nodeA>A</nodeA>
<nodeB>B</nodeB>
</nodes>
</xsl:variable>

<xsl:template name="mainTemplate">
<xsl:apply-templates select="$multiNodes/nodes/*" />
</xsl:template>


<xsl:template match="nodeA | dummyNode">
<xsl:value-of select="local-name()" />
<xsl:text>,</xsl:text>
<xsl:value-of select="." />
<xsl:text>:</xsl:text>
</xsl:template>


<xsl:template match="dummyNode | nodeB">
<xsl:value-of select="local-name()" />
<xsl:text>,</xsl:text>
<xsl:value-of select="." />
<xsl:text>:</xsl:text>
</xsl:template>
</xsl:stylesheet>
(1-1/2)