[XSL-LIST Mailing List Archive Home]
Re: [xsl] How do I capture the text "around" a node?
Subject: Re: [xsl] How do I capture the text "around" a node?|
From: Peter Lavender <plaven@xxxxxxxxxxxxxx>
Date: Wed, 25 Sep 2002 00:25:13 +1000
> > I'm beating my head against a wall here, and haven't been able to
> > work out how to capture the text around a node.
> > Here is the snippet of xml:
> > <book isbn="88888">
> > This book <title>Lord of the rings</title> is often misquoted.
> > ...
> > </book>
Acutally, I should have added a bit more:
<?xml version="1.0" ?>
Its title (<title>The Lord of the Rings</title>)
is often misquoted!
<author>J R R Tolkien</author>
> You could use:
> <xsl:apply-templates select="title/following-sibling::text()" />
I'm sure I actually tried this.
What I'm trying to do is actually capture the text using variables and
substring-before and substring after, to get rid of the chars ().
I haven't succeeded so I was tring to just capture the text().
But applying the template doesn't allow me to only grab the bits of
the text that I want, namely all the text() with out the chars ().
<xsl:variable name="txtFirst" select='substring-before( ./text(), "(" )' />
<xsl:variable name="title" select="title"/>
select='substring-after("title/text()",")" )' />
<xsl:value-of select="$txtFirst" />
<xsl:value-of select="title" />
<xsl:value-of select="$txtAfter" />
Hope that make more sence..
I tried a zillion combinations of sibling-after, child::preceding etc.
I just can't figure out how to grab that last bit of text: ")
is often misquoted!" with out the ")"
Due to a lack of imagination,
this signature will remain
under construction indefinitely.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list