xsl-list
[Top] [All Lists]

[xsl] Retrieving info between two tags.

2007-08-30 08:07:08
Greetings everyone,

I have a situation where I need to define separate out puts for each
para tag within the step1 tag. So I've created a <step1> template and in
it I test the para number and output the correct formatting. For the
first para it outputs the para followed by the seqlist.

The second para's are where I'm having some difficulty. I need pull the
text from the second para into a table row. Then  and pull the item tags
into another row.

So my question is what's the best way to retrieve the non-nested
information in a tag?


XPATH 1.0
SAXON 6.5.5

Example tags:

<step1>
        <para>para1<seqlist>
                <item>1</item>
                <item>2</item>
                <item>3</item></seqlist></para>
        <para>Para2<seqlist>
                <item>1</item>
                <item>2</item>
                <item>3</item></seqlist></para>
        <para>para3</para>
</step1>


In this situation I need to retrieve the text between <para> &
<seqlist>. Originally I tried <xsl:apply-templates select="para[2]". But
that gave me


Para2
        1
        2
        3

The para[2] template match pulled in the seqlist formatting.

So then I tried the value-of select="para[2]" and that gave me

Para2 1 2 3

How can I select and output only what's between <para[2]> and <seqlist>?

XSL:
       <xsl:when test="para[2]">
           <table>
            <tr>
               <td style="PADDING-RIGHT: 2px"><xsl:number
count="//step1[para[2]]" format="1."/></td>
               <td><xsl:value-of select="para"/></td>
            </tr>
            </table>
       </xsl:when>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>