Xpath question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mikael petterson

    #1

    Xpath question

    Hi,

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

    throws TestFailedExcep tion, CorruptHardware Exception,
    TemporarySwFail ureException;

    throws
    TestFailedExcep tionCorruptHard wareExceptionTe mporarySwFailur eException, ;

    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="raisesE xception"><xsl: value-of select="@name"/>
    <xsl:if
    test="raisesExc eption[not[position()=last ()]]"><xsl:text >,</xsl:text></xsl:i
    f>
    </xsl:for-each>;


  • Patrick TJ McPhee

    #2
    Re: Xpath question

    In article <bk70d5$f6d$1@n ewstree.wise.ed t.ericsson.se>,
    mikael petterson <mikaelpetterso n@noreply.com> wrote:

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

    % <xsl:for-each select="raisesE xception"><xsl: value-of select="@name"/>
    % <xsl:if
    % test="raisesExc eption[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="raisesE xception">
    <xsl:value-of select="@name"/>
    <xsl:if test="not(posit ion()=last())"> <xsl:text>,</xsl:text></xsl:if>
    </xsl:for-each>
    <xsl:text>;
    </xsl:text>

    --

    Patrick TJ McPhee
    East York Canada
    ptjm@interlog.c om

    Comment

    Working...