Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access upper node XML element inside lower node XSL template

Status
Not open for further replies.

SilverStray

Programmer
Joined
Oct 25, 2001
Messages
47
Location
AU
Hi,

I'd like to know how, if even possible, to access XML data in the upper node when I am working on a XSL template for the XML's lower node. For the XML code below, I have the excerpt of the XSL template match for the node 'assyData'.

--XML Code---

-<step>
<name>SAW</name>
<desc>Sawing Process</desc>
-<assyStepData>
-<assyData>
<compType>DIE</compType>
<soRemarks>Die in Saw Remarks</soRemarks>
<operInstruction>Die in Saw Instruction</operInstruction>
<ppData />
</assyData>
-<assyData>
<compType>ANGEL</compType>
<soRemarks>Dummy Saw SO Remarks</soRemarks>
<operInstruction>Dummy Saw Instruction</operInstruction>
<ppData />
</assyData>
</assyStepData>

</step>

->>>>And here's my XSL Code:

<xsl:template match="assyData">

<xsl:template match="assyData">
<xsl:choose>
** <xsl:when test="../name='SAW'">
<xsl:text>SAW:</xsl:text>
<xsl:value-of select="soRemarks"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="soRemarks"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

** In the problem area I pointed above, what I wanted
to do is to put a condition if the value of name in
the upper node under step is 'SAW'. But the portion

<xsl:when test="../name='SAW'">

obviously is not the right way for me in doing the
test condition.

Can anybody help me how i may do this?

thanks in advance.

*joni

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top