[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: following-sibling:: within a for-each
Subject: Re: following-sibling:: within a for-each
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Mon, 10 Oct 2005 17:08:33 +0200
|
Hi Houman,
following-sibling:: always follows the source tree and the document order, not the selection and
order of the for-each.
If you can explain in words what you are trying to achieve, we might be able to give some hints for
an alternative approach..
Cheers,
Geert
Khorasani, Houman wrote:
Hello everyone,
This is the first time I am experimenting with following-sibling:: and
am already stuck in here.
I have such a code here:
<xsl:if test="/*/*[substring(name(),8) = 'MeterPulse']">
<xsl:element name="MeterPulseFacility">
<xsl:for-each select="/*/*[substring(name(),8) =
'MeterPulse']"> <xsl:value-of select=" ...some
calculations... "/>
<xsl:text>,</xsl:text>
</xsl:for-each>
</xsl:element>
</xsl:if>
The "...some calculations..." outputs a plain number. Following the
comma within the <xsl:text>,</xsl:text>
The output would be something like
3,2,1,
I wish to eliminate the last comma since there is no need for a further
separation. I thought I could check if there actually is another
incoming sibling in the for-each, if yes then set the comma otherwise do
not set the comma.
<xsl:if test="/*/*[substring(name(),8) = 'MeterPulse']">
<xsl:element name="MeterPulseFacility">
<xsl:for-each select="/*/*[substring(name(),8) =
'MeterPulse']"> <xsl:value-of select=" ...some
calculations... "/>
<xsl:if
test="substring(following-sibling::node()/name(),8) = 'MeterPulse'">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:if>
However the way I wrote it seems to be wrong:
<xsl:if test="substring(following-sibling::node()/name(),8) =
'MeterPulse'">
Any comments please?
Many thanks,
Houman
--
Drs. G.P.H. Josten
Consultant
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken
wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|