On Thursday, March 6, 2003, at 04:09 AM, Daniel Veillard wrote:
Well can you provide a concise example ?
OK, I reduced the input and code down a lot. It still displays the
potential bug. If I'm screwing something up, I'd love to know what. All
of the output paths (/a/b/c/d etc...) are being output from the same
named template each time, which just does this:
<xsl:for-each select="ancestor-or-self::*/@name">
simon
input.xml
================================
<?xml version="1.0"?>
<grammar>
<start>
<element name="a">
<optional>
<element name="b">
<optional>
<element name="c">
<optional>
<attribute name="d">
<choice>
<value>
standard
</value>
</choice>
</attribute>
</optional>
</element>
</optional>
</element>
</optional>
</element>
</start>
</grammar>
bug.xsl
================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="choice/*">
<other>
<path>
<xsl:call-template name="RNGPathToSelf"/>
</path>
<xsl:apply-templates/>
</other>
</xsl:template>
<xsl:template match="value|optional|element|attribute">
<something>
<path>
<xsl:call-template name="RNGPathToSelf"/>
</path>
<xsl:apply-templates/>
</something >
</xsl:template>
<xsl:template name="RNGPathToSelf">
<xsl:for-each select="ancestor-or-self::*/@name">
<xsl:text>/</xsl:text>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
OUTPUT
================================
[simons-tibook:~/Sites/simonwoodside.com/exp] woodside% xsltproc
bug.xsl input.xml
<?xml version="1.0"?>
<something><path>/a</path>
<something><path>/a</path>
<something><path>/a/b</path>
<something><path>/a/b</path>
<something><path>/a/b/c</path>
<something><path>/a/b/c</path>
<something><path>/c/d/a/b</path>
<other><path>/c/d/a/b</path>
standard
</other>
</something>
</something>
</something>
</something>
</something>
</something>
</something>
[simons-tibook:~/Sites/simonwoodside.com/exp] woodside% sabcmd bug.xsl
input.xml
<?xml version="1.0" encoding="UTF-8"?>
<something>
<path>/a</path>
<something>
<path>/a</path>
<something>
<path>/a/b</path>
<something>
<path>/a/b</path>
<something>
<path>/a/b/c</path>
<something>
<path>/a/b/c</path>
<something>
<path>/a/b/c/d</path>
<other>
<path>/a/b/c/d</path>
standard
</other>
</something>
</something>
</something>
</something>
</something>
</something>
</something>
[simons-tibook:~/Sites/simonwoodside.com/exp] woodside%
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list