Subject: RE: [xsl] Retrieving info between two tags. From: "Maxine Pensyl-Johnson" <Maxine.Pensyl-Johnson@xxxxxxx> Date: Thu, 30 Aug 2007 08:47:05 -0700 |
Thank you for the correction. I'll be more aware of my vocabulary. <xsl:value-of select="/step1/para[2]/node()[1]" /> Outputs nothing. -----Original Message----- From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx] Sent: Thursday, August 30, 2007 8:42 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Retrieving info between two tags. The XPath expression you need can be written is a number of ways, depending on the context from which it is called. This will work anywhere in your stylesheet, but it could be expressed other ways. <xsl:value-of select="/step1/para[2]/node()[1]" /> P.S. I realize you are new here, so before someone else gives you a sterner lecture, let me draw your attention to some vocabulary issues. There was a very funny "dictionary" posted to this list some months back. I can't find the link, but the idea was that "tag" was used for so many, unrelated ideas, that the term has become confusing. This (<step1>) is a tag. This is another tag (</step1>). Both tags together, along with all the tags and text in between are properly called an "element". So when you want to talk about elements, it's best to avoid the term "tag". -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: Maxine Pensyl-Johnson <Maxine.Pensyl-Johnson@xxxxxxx> Sent: Thu, 30 Aug 2007 08:06:05 -0700 To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: [xsl] Retrieving info between two tags. 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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Retrieving info between t, cknell | Thread | Re: [xsl] Retrieving info between t, Abel Braaksma |
RE: [xsl] Retrieving info between t, cknell | Date | RE: RE: [xsl] Retrieving info betwe, cknell |
Month |