[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

text() vs xs:string serialization (was: Re: text

Subject: text() vs xs:string serialization (was: Re: text extraction)
From: "James A. Robinson" <jim.robinson@xxxxxxxxxxxx>
Date: Thu, 12 Oct 2006 07:09:57 -0700
650 xs
This is awful form,  but I'm going to respond to my own answer
with a question.  One of the things I played around with when
writing the message below was how the serialization handled
separation of the output sequences.

Am I correct in my understanding that the reason the stylesheet
below works, separating each item from the <xsl:sequence/> with
a single whitespace character, is due to

 http://www.w3.org/TR/xslt-xquery-serialization/#serdm

where a sequence of strings will be padded, but a sequence of
text nodes will not be?  In other words, is that reference
above the reason that either

  <xsl:sequence select="string(.)"/>

or

  <xsl:sequence select="normalize-space(.)"/>

work, giving, 'text1 text2 text3', whereas

  <xsl:sequence select="."/> <!-- selecting text() node -->

would result in 'text1text2text3' ?
 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
>   <xsl:output method="text"/>
>   <xsl:template match="node()">
>     <xsl:apply-templates select="node()"/>
>   </xsl:template>
>   <xsl:template match="text()[parent::*[self::E1|self::E2]]">
>     <xsl:sequence select="normalize-space(.)"/>
>   </xsl:template>
> </xsl:stylesheet>
> 
> That would let you handle, for example, something like
> 
> <V><E1>text<E2>text2<baz>smorth</baz></E2>text3<flober>chum</flober></E1></V>
> 
> Jim
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> James A. Robinson                       jim.robinson@xxxxxxxxxxxx
> Stanford University HighWire Press      http://highwire.stanford.edu/
> +1 650 7237294 (Work)                   +1 650 7259335 (Fax)
> 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@xxxxxxxxxxxx
Stanford University HighWire Press      http://highwire.stanford.edu/
+1 650 7237294 (Work)                   +1 650 7259335 (Fax)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.