Subject: RE: [xsl] creating a string of child node names From: Haydn Flower <Haydn.Flower@xxxxxxxxxxx> Date: Wed, 3 Dec 2003 11:22:46 -0000 |
I figured it out already :) <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="Invoice"> <xsl:variable name="var-names"> <xsl:call-template name="node-names"> <xsl:with-param name="list" select="node()"/> </xsl:call-template> </xsl:variable> <input name="X2H_VAR_NAMES" value="{$var-names}" type="hidden"/> </xsl:template> <xsl:template name="node-names"> <xsl:param name="list"/> <xsl:choose> <xsl:when test="$list"> <xsl:variable name="first" select="name($list[1])"/> <xsl:variable name="rest-of-string"> <xsl:call-template name="node-names"> <xsl:with-param name="list" select="$list[position()!=1]"/> </xsl:call-template> </xsl:variable> <xsl:value-of select="concat($first,',',$rest-of-string)"/> </xsl:when> </xsl:choose> </xsl:template> </xsl:stylesheet> -----Original Message----- From: Haydn Flower [mailto:Haydn.Flower@xxxxxxxxxxx] Sent: 03 December 2003 10:32 To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' Subject: [xsl] creating a string of child node names I need to build up a string if child node names. so far I have <xsl:template match="Invoice"> <input name="X2H_VAR_NAMES" value="{name(./*)}" type="hidden"/> </xsl:template> this is a sample of the xml file <Invoice> <InvoiceNumber/> <DespatchNoteNumber/> <OrderNumber /> <AccountNo/> </Invoice> my result only has <input name="X2H_VAR_NAMES" value="InvoiceNumber" type="hidden"/> and I would like <input name="X2H_VAR_NAMES" value="InvoiceNumber,DespatchNoteNumber,OrderNumber,AccountNo" type="hidden"/> Thank you for your help ******************************************************* 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 ******************************************************* 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] creating a string of chil, Manolis Mavrikis | Thread | Re: [xsl] creating a string of chil, David Carlisle |
Re: [xsl] Re: HOWTO: convert flat l, andrew . curry | Date | Re: [xsl] Re: HOWTO: convert flat l, David Tolpin |
Month |