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

Re: Question on space normalization in serialization

Subject: Re: Question on space normalization in serialization
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Sep 2015 22:26:31 -0000
Re:  Question on space normalization in serialization
As it happens Ibve been experimenting over the last couple of days
(encouraged by friends at oXygen) with bypassing the XML parserbs
attribute-value normalization when applied to stylesheets, so that the XPath
expression as parsed is the expression as written, enabling more accurate
diagnostics especially with long multi-line XPath expressions.

The trouble is it breaks edge cases where people really want those newlines in
string literals turned into spaces. Or rather, where they wrote test cases
that break if you change this.

Michael Kay
Saxonica


> On 1 Sep 2015, at 22:37, David Carlisle d.p.carlisle@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On 1 September 2015 at 22:16, David Sewell dsewell@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> I am probably forgetting something basic in the XSLT specs about how
string
>> variables are created and evaluated, but I was experimenting with
including
>> CSS rules within an XSLT stylesheet and then writing them at run time
along
>> with the output of my transformation via xsl:result-document. I discovered
>> that if I put the CSS into a string variable using the @select attribute,
>> linefeeds are not preserved in the output; but if I put the CSS text into
a
>> sequence constructor, the linefeeds are preserved in the output. What's
the
>> underlying reason, assuming this isn't implementation-dependent? (I'm
>> testing with Saxon; XSLT 2 and 3 produce identical results.)
>>
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>  xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>  exclude-result-prefixes="xs"
>>  version="2.0">
>>  <xsl:variable name="CSS1" as="xs:string" select="'
>>    p { color:pink; }
>>    a { font-family: fantasy}
>>    '"/>
>>  <xsl:variable name="CSS2" as="xs:string">
>>    p { color:pink; }
>>    a { font-family: fantasy}
>>  </xsl:variable>
>>  <xsl:template name="main">
>>    <xsl:result-document href="test1.css" method="text">
>>      <xsl:value-of select="$CSS1"/>
>>    </xsl:result-document>
>>    <xsl:result-document href="test2.css" method="text">
>>      <xsl:value-of select="$CSS2"/>
>>    </xsl:result-document>
>>  </xsl:template>
>> </xsl:stylesheet>
>>
>> --
>> David Sewell, Editorial and Technical Manager
>> ROTUNDA, The University of Virginia Press
>> PO Box 400318, Charlottesville, VA 22904-4314 USA
>> Email: dsewell@xxxxxxxxxxxx   Tel: +1 434 924 9973
>> Web: http://rotunda.upress.virginia.edu/
>> --------------------------------------------------------------
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> EasyUnsubscribe: -list/293509
> or by email:
> --~--

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.