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

How do I get the name of the current node

Subject: How do I get the name of the current node
From: Mike Clarke <Mike.Clarke@xxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Oct 2000 16:04:16 +0100
xsl get current node name
I think I've missed something fairly fundamental, which I'm sure you'll all
spot in a second.
I want to use <xsl:choose> to identify nodes in a result set. For example
for the XML

<assembly>
	<sprogit sku="180" colour="blue" /> 
	<dofer    sku="094401" kind="fluffy" />
	<sprogit sku="1094" colour="pink" /> 
	<widget  sku="999" legs="5" />
     <dofer    sku="000801" kind="crispy" />
</assembly>

I thought I could write some simple XSL that could handle each element of
the assembly :

<xsl:for-each select="assembly/*">	
<xsl:choose>
		<xsl:when test="./sprogit">
			<td> <xsl:value-of select="@sku"/> </td><td> 0
</td><td> <xsl:value-of select="@colour"/><td> Hard </td>
		</xsl:when>
		<xsl:when test="./widget">
			<td> <xsl:value-of select="@sku"/> </td><td>
<xsl:value-of select="@legs"/> </td> grey <td> <td> Hard </td>
		</xsl:when>
		<xsl:when test="./dofer">
			<td> <xsl:value-of select="@sku"/> </td><td> 0 </td>
grey <td> <td> <xsl:value-of select="@kind"/> </td>
		</xsl:when>
</xsl:choose>

However the individual when's never get executed. I've tried several
different approaches and I've looked in all the XSL resources and I can only
find examples that match attributes or strings. How do I match the name of
the node ?

Regards

Mike C






 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.