[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] concat selected text nodes


Subject: RE: [xsl] concat selected text nodes
From: "Steve Renshaw" <renshaw_steve@xxxxxxxxxxx>
Date: Fri, 20 Apr 2001 17:39:43 -0000

The "|" char is just a debug aid so I can see spaces.
The b ig picture is that the purpsoe of the ver tag
is to indicate strikeout and insertion. If you start
with

"This is an old sentance"

Someone markups up the original text into:

<item>This is a<ver id="0">n old</ver> <ver id="1">new</ver> sentance.</item>

To indicate what is struck-out and what 'stuck-in' yielding:

"This is a new sentance"

The <ver id="0"> marks what is struck-out and <ver id="1>
marks what is 'struck-in'. The stylesheet is to return the
new vesion of the text sans all tags. Presumably is the
text kept changing, you could creteate it at any ponit
int time.


From: "Clapham, Paul" <pclapham@xxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] concat selected text nodes
Date: Fri, 20 Apr 2001 10:28:40 -0700

When you say "concatenate" them, do you mean you want them contiguous in the
output with no newlines intervening, like this?


|This is a||new|| sentance.|

If so, then all you have to do is not put in those newlines. At present
what you see as "|" is actually a text node in your stylesheet that consists
of a newline character plus a bunch of spaces plus a | character. Try using
this line instead:


<xsl:text>|<xsl:text/><xsl:value-of select="."/>|<br/>

PC2

-----Original Message-----
From: Steve Renshaw [mailto:renshaw_steve@xxxxxxxxxxx]
Sent: April 20, 2001 09:56
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] concat selected text nodes


David, your code just returns "This is a" - nothing mroe. You code and my best effort is blw;

<xsl:template match="item">
  <xsl:variable name="x">
     <xsl:value-of select="text()|ver[@id=$ver]"/>
  </xsl:variable>
<xsl:value-of select="$x"/><br/><br/>

<xsl:for-each select="//text()[parent::*/@id='1' or not(parent::*/@id)]">
|<xsl:value-of select="."/>|<br/>
</xsl:for-each>
</xsl:template>


XML:
<item>This is a<ver id="0">n old</ver> <ver id="1">new</ver>
sentance.</item>

Produces:
This is a    <- David

|This is a|  <-
|new|        <- my best so far
| sentance.| <-

How can I concatenate my three pieces?

"This is a new sentance."

Having trouble doing it with string() which should concat.

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


_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com


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




Current Thread