This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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@Xitec-Software.com]
>Sent: Thursday, October 26, 2000 11:04 AM
>To: XSL-List@mulberrytech.com
>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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]