Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6178294

XSLTC doesn't work with "use-attribute-sets"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • xml

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Converting a XML file using attribute sets doesn't work with XSLTC. The same stylesheet translated with java version 1.4.x (interpretive) works fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      XML file:

      <?xml version="1.0" encoding="UTF-8"?>
      <portfolio>
        <stock>
          <symbol>SUNW</symbol>
          <name>Sun Microsystems</name>
          <price>17.1</price>
        </stock>
        <stock>
          <symbol>AOL</symbol>
          <name>America Online</name>
          <price>51.05</price>
        </stock>
        <stock>
          <symbol>IBM</symbol>
          <name>International Business Machines</name>
          <price>116.10</price>
        </stock>
        <stock>
          <symbol>MOT</symbol>
          <name>MOTOROLA</name>
          <price>15.20</price>
        </stock>
      </portfolio>


      XSL file:

      <?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="/">
          
              <xsl:element name="portfolio">
                  <xsl:for-each select="/portfolio/stock">
                      <xsl:element name="stock" use-attribute-sets="testattribs" />
                  </xsl:for-each>
              </xsl:element>

          </xsl:template>
          
          <xsl:attribute-set name="testattribs">
              <xsl:attribute name="symbol">
                  <xsl:value-of select="symbol"/>
              </xsl:attribute>
              <xsl:attribute name="name">
                  <xsl:value-of select="name"/>
              </xsl:attribute>
              <xsl:attribute name="price">
                  <xsl:value-of select="price"/>
              </xsl:attribute>
          </xsl:attribute-set>
      </xsl:stylesheet>



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      <?xml version="1.0" encoding="UTF-8"?>
      <portfolio>
      <stock symbol="SUNW" name="Sun Microsystems" price="17.1"/>
      <stock symbol="AOL" name="America Online" price="51.05"/>
      <stock symbol="IBM" name="International Business Machines" price="116.10"/>
      <stock symbol="MOT" name="MOTOROLA" price="15.20"/>
      </portfolio>
      ACTUAL -
      <?xml version="1.0" encoding="UTF-8"?>
      <portfolio>
      <stock symbol="" name="" price=""/>
      <stock symbol="" name="" price=""/>
      <stock symbol="" name="" price=""/>
      <stock symbol="" name="" price=""/>
      </portfolio>

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // asume that
      // args[0]: input file
      // args[1]: output file
      // args[2]: xsl file

      Transformer trans = TransformerFactory.newInstance ().newTransformer (new StreamSource (new File (args[2])));

      trans.transform (new StreamSource (new File (args[0])), new StreamResult (new File (args[1])));

      ---------- END SOURCE ----------
      ###@###.### 10/13/04 05:52 GMT

            spericas Santiago Pericasgeertsen
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: