[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: bug in LibXSLT???

Subject: Re: bug in LibXSLT???
From: S Woodside <sbwoodside@xxxxxxxxx>
Date: Fri, 7 Mar 2003 02:25:53 -0500
libxslt xsl output indent

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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.