Hi all!
If I have a template rule:
<xsl:template match="wobble">
<xsl:element name="{name()}"
namespace=http://www.example.com/schema/wibble/0>
<xsl:apply-templates select="node() | @*"/>
</xsl:element>
</xsl:template>
Does that also apply to children of matched elements?
Because with the Xalan interpreter it *does*:
Input:
<outer><wobble><inner><event/></inner></wobble></outer>
Output:
<outer>
<wobble xmlns=http://www.example.com/schema/wibble/0>
<inner>
<event/>
</inner>
</wobble>
</outer>
But with the Xalan Compiler it *doesn?t*:
<outer>
<ns0:wobble xmlns:ns0=http://www.example.com/schema/wibble/0>
<inner>
<event/>
</inner>
</ns0:wobble>
</outer>
If I change the template to:
<xsl:template match="*[ancestor-or-self::wobble]">
<xsl:element name="{name()}"
namespace=http://www.example.com/schema/wibble/0>
<xsl:apply-templates select="node() | @*"/>
</xsl:element>
</xsl:template>
The Xalan interpreter gives the same output, but the compiler now gives:
<outer>
<ns0:wobble xmlns:ns0=http://www.example.com/schema/wibble/0>
<ns0:inner>
<ns0:event/>
</ns0:inner>
</ns0:wobble>
</outer>
Which, I believe, is now semantically identical to the interpreted output.
So the root question is: Is there a bug in the interpreter? If so, is it new?
Full stylesheet used:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=http://www.w3.org/1999/XSL/Transform
xmlns:NS1=http://www.example.com/schema/wibble/1>
<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>
</xsl:template>
<xsl:template match="*[ancestor-or-self::wobble]">
<xsl:element name="{name()}"
namespace=http://www.example.com/schema/wibble/0>
<xsl:apply-templates select="node() | @*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Cheers,
Andreas Martens
--
Senior Engineer
IBM App Connect Enterprise
Unless otherwise stated above:
IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: Building C, IBM Hursley Office, Hursley Park Road,
Winchester, Hampshire SO21 2JN