|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How do I get the name of the current node
<xsl:when test="name()='sprogit'">
Consider approaching this a different way - instead of trying to figure out
as you go along which element you're dealing with, use apply-templates to do
the work (i.e. the "choose" part) for you. Like this
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="assembly/*" />
</xsl:template>
<xsl:template match="sprogit">
<td> <xsl:value-of select="@sku"/> </td><td> 0 </td>
<td> <xsl:value-of select="@colour"/></td><td> Hard </td>
</xsl:template>
<xsl:template match="widget">
<td> <xsl:value-of select="@sku"/> </td>
<td><xsl:value-of select="@legs"/> </td><td> grey </td> <td> Hard
</td>
</xsl:template>
<!-- more <xsl:template> here, one for "dofer", etc. -->
</xsl:stylesheet>
>-----Original Message-----
>From: Mike Clarke [mailto:Mike.Clarke@xxxxxxxxxxxxxxxxxx]
>Sent: Thursday, October 26, 2000 11:04 AM
>To: XSL-List@xxxxxxxxxxxxxxxx
>Subject: How do I get the name of the current node
>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>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








