Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-739

Unexpected output when using identity transformation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.11
    • None
    • XalanC
    • Linux

    Description

      Input XSL
      <?xml version="1.0" encoding="utf-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common">
      <xsl:output method="xml" indent="yes" />
      <!-- ********************************************* -->
      <xsl:template match="/body/div//a" mode="test-mode">
      <xsl:copy>
      <xsl:attribute name="new_attr">1</xsl:attribute>
      <xsl:apply-templates select="@*|node()" mode="test-mode" />
      </xsl:copy>
      </xsl:template>
      <xsl:template match="node()|@*" mode="test-mode">
      <xsl:copy>
      <xsl:apply-templates select="@*|node()" mode="test-mode" />
      </xsl:copy>
      </xsl:template>
      <!-- ********************************************* -->
      <xsl:template match="/">
      <xsl:copy>
      <xsl:apply-templates select="." mode="test-mode" />
      </xsl:copy>
      </xsl:template>
      </xsl:stylesheet>

      Input XML
      <body>
      <div>
      <div>
      <a href="abc.pdf" >Testing</a>
      </div>
      </div>
      </body>

      Expected Output:
      <?xml version="1.0"?>
      <body>
      <div>
      <div>
      <a new_attr="1" href="abc.pdf">Testing</a>
      </div>
      </div>
      </body>

      Actual Output:
      <?xml version="1.0" encoding="UTF-8"?>
      <body>
      <div>
      <div>
      <a href="abc.pdf">Testing</a>
      </div>
      </div>
      </body>

      I receive the expected results when I run this transformation through xsltproc on Linux.

      Attachments

        1. test.cpp
          1 kB
          Jeff Cohen
        2. test.html
          0.1 kB
          Jeff Cohen
        3. test.xsl
          0.9 kB
          Jeff Cohen

        Activity

          People

            shathaway Steven J. Hathaway
            jeffcohen123 Jeff Cohen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: