[Home] [By Thread] [By Date] [Recent Entries]

Subject: xslt 2.0, 3.0 attribute 'match' question
From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Feb 2026 09:15:18 -0000
Dear xsl-list,
    There's following XSLT test case (attr/match, test case name match-036
with <spec value="XSLT20+"/>) within W3C XSLT 3.0 test suite.

XML document:

<?xml version="1.0"?>
<doc xmlns:a="http://a.com/" xmlns:b="http://b.com/" xmlns:c="http://c.com/"
xmlns:d="http://d.com/">
  <a:element a:attribute="1">
    <b:element b:attribute="2">
      <c:element c:attribute="3">
        <d>
         <element attribute="4"/>
        </d>
      </c:element>
    </b:element>
  </a:element>
</doc>

XSLT document:

(I've added, <xsl:output method="xml" indent="yes"/> to produce indented
XML transform result that help with discussion)

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         version="2.0">

   <xsl:strip-space elements="foo"/>

   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="doc">
      <out>
          <xsl:apply-templates/>
      </out>
   </xsl:template>

   <xsl:template match="*:element">
      [<xsl:value-of select="name()"/>}
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
   </xsl:template>

   <xsl:template match="@*:attribute">
     (@<xsl:value-of select="name()"/>)
   </xsl:template>

</xsl:stylesheet>

Using Saxon HE 12.9, we get following XSL transform result for this test
case,

<?xml version="1.0" encoding="UTF-8"?>
<out>

  [a:element}

  (@a:attribute)


  [b:element}

  (@b:attribute)


  [c:element}

  (@c:attribute)



  [element}

  (@attribute)





</out>

Whereas, Xalan XSLT 3.0 development code, produces following XSL transform
result for this test case,


<?xml version="1.0" encoding="UTF-8"?>
<out>

  [a:element}

  (@a:attribute)


  [b:element}

  (@b:attribute)


  [c:element}

  (@c:attribute)


  [d}


  [element}

  (@attribute)





</out>


I think that, Xalan XSLT 3.0 development code, is producing correct result
for this test case. Saxon is missing [d} within an XSL transform result for
this test case.

Thanks in advance, for any insights to discuss this XSL transform example.


-- 
Regards,
Mukul Gandhi

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member