DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6470>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6470

parent:: axis doesn't work in template example

           Summary: parent:: axis doesn't work in template example
           Product: XalanJ2
           Version: 2.2.0
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following statement works:

           <xsl:value-of select="../colData[@colId='LOCATION']"/>

whereas the "parent::" equivalent does not:

           <xsl:value-of select="parent::colData[@colId='LOCATION']"/>

When used in the following XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >

<xsl:template match="/report">
        <values>
          <xsl:apply-templates select="//colData[@colId='FLIGHT_NO']" />
        </values>
</xsl:template>
<xsl:template match="colData">
  <td><xsl:value-of select="parent::colData[@colId='FLIGHT_NO']"/></td>
  <td><xsl:value-of select="parent::colData[@colId='LOCATION']"/></td>
  <td><xsl:value-of select="parent::colData[@colId='FAULT_CODE']"/></td>
</xsl:template>

</xsl:stylesheet>

with the following XML file:

<?xml version="1.0" encoding="UTF-8"?>
<report>
   <row>
        <colData colId="FLIGHT_NO">1</colData>
        <colData colId="LOCATION">AIR</colData>
        <colData colId="FAULT_CODE">22984</colData>
   </row>
   <row>
        <colData colId="FLIGHT_NO">2</colData>
        <colData colId="LOCATION">AIR</colData>
        <colData colId="FAULT_CODE">10521</colData>
   </row>
   <row>
        <colData colId="FLIGHT_NO">2</colData>
        <colData colId="LOCATION">GND</colData>
        <colData colId="FAULT_CODE">10525</colData>
   </row>
   <row>
        <colData colId="FLIGHT_NO">4</colData>
        <colData colId="LOCATION">GND</colData>
        <colData colId="FAULT_CODE">22976</colData>
   </row>
</report>

Regards,
Mark Peterson

Reply via email to