Re: [xsl] Retrieving info between two tags.

Subject: Re: [xsl] Retrieving info between two tags.
From: Abel Braaksma <>
Date: Thu, 30 Aug 2007 21:29:38 +0200
Maxine Pensyl-Johnson wrote:
I removed the step1 and it worked.

then your input is different from what you posted, or your context item is different. But if you used the /step1/.. syntax, the context is "ignored": i.e., the path is absolute. If your data does not have a root node with <step1> (as it does in what you showed us), it will not work. Same for the stylesheet of Charles below, it will only work when you test it with the same data you've given us.

Moral of this story: be sure that what you post to this list is equal to your testing environment, or make sure that we are given enough info of your testing environment (in this case, it might've been that your select path was inside an <xsl:template match="step1"> which would explain the lot).

-- Abel Braaksma

-----Original Message-----
From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx] Sent: Thursday, August 30, 2007 8:51 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: RE: [xsl] Retrieving info between two tags.

This stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  <xsl:strip-space elements="*" />
  <xsl:output method="xml" indent="yes" encoding="UTF-8" />

    <xsl:template match="/">
      <xsl:value-of select="step1/para[2]/node()[1]" />


When run against this document:


Produces this output:

<?xml version="1.0" encoding="UTF-8"?>Para2

Current Thread