Xpath question

M

mikael petterson

Hi,

I am selecting all <raisesException>-tags. The output must look like this;

throws TestFailedException, CorruptHardwareException,
TemporarySwFailureException;

throws
TestFailedExceptionCorruptHardwareExceptionTemporarySwFailureException, ;

I need to have a comma ( ,) between all exceptions until the last were I
only have a semicolon ( ;).

Any hints?

//Mikael

This is the xsl I have:
==============
<xsl:for-each select="raisesException"><xsl:value-of select="@name"/>
<xsl:if
test="raisesException[not[position()=last()]]"><xsl:text>,</xsl:text></xsl:i
f>
</xsl:for-each>;
 
P

Patrick TJ McPhee

% This is the xsl I have:
[or part of it at any rate]

% <xsl:for-each select="raisesException"><xsl:value-of select="@name"/>
% <xsl:if
% test="raisesException[not[position()=last()]]"><xsl:text>,</xsl:text></xsl:i
% f>

1st problem: you want not(position()=last()), rather than not[...].
2nd problem: that's all you want in the test

<xsl:for-each select="raisesException">
<xsl:value-of select="@name"/>
<xsl:if test="not(position()=last())"><xsl:text>,</xsl:text></xsl:if>
</xsl:for-each>
<xsl:text>;
</xsl:text>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top