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).
Cheers,
-- Abel Braaksma
-----Original Message-----
From: cknell(_at_)onebox(_dot_)com [mailto:cknell(_at_)onebox(_dot_)com]
Sent: Thursday, August 30, 2007 8:51 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: RE: [xsl] Retrieving info between two tags.
This stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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]" />
</xsl:template>
</xsl:stylesheet>
When run against this document:
<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>
Produces this output:
<?xml version="1.0" encoding="UTF-8"?>Para2
--~------------------------------------------------------------------
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>
--~--