Re: [xsl] How do I capture the text "around" a node?

Subject: Re: [xsl] How do I capture the text "around" a node?
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Wed, 25 Sep 2002 15:04:05 +0100
Peter Lavender wrote:

>Acutally, I should have added a bit more:
>
><?xml version="1.0" ?>
><book isbn="1234567890">
>
>Its title (<title>The Lord of the Rings</title>)
>
>is often misquoted!
>
><author>J R R Tolkien</author>
>
>...
>
></book>

This begs a question, if these pesky () are so hard to get rid of, why
are they there in the first place?

You imply that <title/> is *always* surrounded by ().  I guess you
have some other stylesheet for this document which leaves them in?

In which case you might find it much easier to either

a) leave them out of the document altogether, and add them back in the
other stylesheet.

b) instead of writing () invent an element to do the same job, i.e.
write
<parenthesis><title>...</title></parenthesis>

In other words, check your design: is the () really text, or is it
some kind of markup?  If the latter, revisit the design if you can.

Difficult programming tasks are often the result of imperfect design.
This seems to be particularly true of XML+XSLT for some reason.

HTH
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread