By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

Xpath question

P: n/a
Hi,

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

throws TestFailedException, CorruptHardwareException,
TemporarySwFailureException;

throws
TestFailedExceptionCorruptHardwareExceptionTempora rySwFailureException, ;

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>;
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <bk**********@newstree.wise.edt.ericsson.se>,
mikael petterson <mi*************@noreply.com> wrote:

% 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>

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.