|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Finding the current node type
you don't mean node type which means (in xpath parlance) "element" or "comment" etc. You want the node name test, along the self axis rather than the default child axis, so <xsl:when test="self::speaker"> note however that dowing a big xsl:choose matching on node names is just a poor man's version of template matching. If there are only two cases it doesn't really matter but it's usually more efficient to use template matching as the system will (probably) have some efficient hashed switch on element names, but an xsl:choose probably implies a sequential set of tests so time proportional to the number of cases. so you could code it as <xsl:apply-templates match="speaker|laptop"/> <xsl:template match="speaker"> <!-- Assign a sequential Number --> Item No: <xsl:value-of select="position()"/> <br /> <!-- Now output item-specific details --> RMS Power: <xsl:value-of select="rms_power"/> <br /> Peak Power: <xsl:value-of select="peak_power"/> <br /> ... David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
|
Back To School Sale!Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop. 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
|






