Subject: RE: [xsl] Easy way to identify node type? From: Haydn Flower <Haydn.Flower@xxxxxxxxxxx> Date: Thu, 4 Dec 2003 16:31:57 -0000 |
Yes, You've gotta use an XPath type statement which use expressions (kind of similar to perl expressions but different), give an example of your input xml and which elements you want matched. -----Original Message----- From: yguaba@xxxxxxxxxxxx [mailto:yguaba@xxxxxxxxxxxx] Sent: 04 December 2003 16:23 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Easy way to identify node type? Is there an easy way (or any way at all) to identify the type of the node being processed? Suppose, for instance, that you wanted to produce different output for different node types, as in the *fictitious* example below: <xsl:template match="root"> <xsl:for-each select="node()"> <xsl:choose> <xsl:when test="node-type() = 'ELEMENT'"> <xsl:text>blah, blah</xsl:text> </xsl:when> <xsl:when test="node-type() = 'TEXT'"> <xsl:value-of select="."/> </xsl:when> ... </xsl:choose> </xsl:for-each> </xsl:template> Is there a way to do that? Thanks in advance for your input, Erik XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ******************************************************* This email has originated from Perwill plc (Registration No. 1906964) Office registered at: 13A Market Square, Alton, Hampshire, GU34 1UR, UK Tel: +44 (0)1420 545000 Fax: +44 (0)1420 545001 www.perwill.com ******************************************************* Privileged, confidential and/or copyright information may be contained in this email, and is only for the use of the intended addressee. To copy, forward, disclose or otherwise use it in any way if you are not the intended recipient or responsible for delivering to him/her is prohibited. If you receive this email by mistake, please advise the sender immediately, by using the reply facility in your email software. We may monitor the content of emails sent and received via our network for the purposes of ensuring compliance with policies and procedures. This message is subject to and does not create or vary any contractual relationships between Perwill plc and the recipient. ******************************************************* Any opinions expressed in the email are those of the sender and not necessarily of Perwill plc. ******************************************************* This email has been scanned for known viruses using Sophos MailMonitor ******************************************************* XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Easy way to identify node, G. Ken Holman | Thread | [xsl] repeating XML data in output, Dan |
[xsl] Easy way to identify node typ, yguaba | Date | [xsl] repeating XML data in output, Dan |
Month |