[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] text() vs xs:string serialization (was: Re: text
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)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|