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

Re: Re: Initial whitespace in PI from XSLT, appendices

Subject: Re: Re: Initial whitespace in PI from XSLT, appendices
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 May 2022 21:51:49 -0000
Re:  Re: Initial whitespace in PI from XSLT
https://www.w3.org/TR/xslt-30/#constructing-simple-content :

"
.  .  .
6. In the case of xsl:processing-instruction
<https://www.w3.org/TR/xslt-30/#element-processing-instruction>, any
leading spaces in the resulting string are removed.
"



On Sat, May 7, 2022 at 2:34 PM Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> *APPENDIX A:* XSLT program and input document
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   version="1.0">
>
>   <?syd nospace?>
>   <?syd already normalized space?>
>   <?syd lots of     space    between  stuff   ?>
>   <?syd     leading spaces      and     tabs    between!?>
>   <?syd letbs try a new
>     line ?>
>   <?syd
>     leading newline?>
>
>   <xsl:template match="/">
>     <anOutermostElement>
>       <xsl:text>&#x0A;</xsl:text>
>       <xsl:apply-templates select="//processing-instruction()"/>
>     </anOutermostElement>
>   </xsl:template>
>
>   <xsl:template match="processing-instruction()">
>     <!-- Announce that we are processing the next PI: -->
>     <xsl:text>--------- first 3 chars=</xsl:text>
>     <xsl:value-of select="concat('b', substring( ., 1, 3 ), 'b')"/>
>
>     <!-- Try copying to output: -->
>     <xsl:text>&#x0A;     copy: </xsl:text>
>     <xsl:copy/>
>
>     <!-- I expect this different way of expressing "copy this" to do the
> same thing: -->
>     <xsl:text>&#x0A;  copy-of: </xsl:text>
>     <xsl:copy-of select="."/>
>
>     <!-- Construct a new processing instruction based on the input: -->
>     <xsl:text>&#x0A; proc-ins: </xsl:text>
>     <xsl:processing-instruction name="{name(.)}">
>       <xsl:value-of select="."/>
>     </xsl:processing-instruction>
>
>     <!-- Construct, but normalize space on the value string first: -->
>     <xsl:text>&#x0A; norm-spc: </xsl:text>
>     <xsl:processing-instruction name="{name(.)}">
>       <xsl:value-of select="normalize-space(.)"/>
>     </xsl:processing-instruction>
>
>     <!-- Construct, but (try to) force a space as 1st char: -->
>     <xsl:text>&#x0A;insrt-spc: </xsl:text>
>     <xsl:processing-instruction name="{name(.)}">
>       <xsl:value-of select="concat(' ', normalize-space(.) )"/>
>     </xsl:processing-instruction>
>
>     <!-- Construct, but (try to) force a newline as 1st char: -->
>     <xsl:text>&#x0A;insrt-nln: </xsl:text>
>     <xsl:processing-instruction name="{name(.)}">
>       <xsl:value-of select="concat('&#x0A;', normalize-space(.) )"/>
>     </xsl:processing-instruction>
>
>     <xsl:text>&#x0A;</xsl:text>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> *APPENDIX B:* Output from `xsltproc`
> <?xml version="1.0"?>
> <anOutermostElement>
> --------- first 3 chars=bnosb
>      copy: <?syd nospace?>
>   copy-of: <?syd nospace?>
>  proc-ins: <?syd nospace?>
>  norm-spc: <?syd nospace?>
> insrt-spc: <?syd  nospace?>
> insrt-nln: <?syd
> nospace?>
> --------- first 3 chars=balrb
>      copy: <?syd already normalized space?>
>   copy-of: <?syd already normalized space?>
>  proc-ins: <?syd already normalized space?>
>  norm-spc: <?syd already normalized space?>
> insrt-spc: <?syd  already normalized space?>
> insrt-nln: <?syd
> already normalized space?>
> --------- first 3 chars=blotb
>      copy: <?syd lots of     space    between  stuff   ?>
>   copy-of: <?syd lots of     space    between  stuff   ?>
>  proc-ins: <?syd lots of     space    between  stuff   ?>
>  norm-spc: <?syd lots of space between stuff?>
> insrt-spc: <?syd  lots of space between stuff?>
> insrt-nln: <?syd
> lots of space between stuff?>
> --------- first 3 chars=bleab
>      copy: <?syd leading spaces and     tabs    between!?>
>   copy-of: <?syd leading spaces and     tabs    between!?>
>  proc-ins: <?syd leading spaces and     tabs    between!?>
>  norm-spc: <?syd leading spaces and tabs between!?>
> insrt-spc: <?syd  leading spaces and tabs between!?>
> insrt-nln: <?syd
> leading spaces and tabs between!?>
> --------- first 3 chars=bletb
>      copy: <?syd letbs try a new
>     line ?>
>   copy-of: <?syd letbs try a new
>     line ?>
>  proc-ins: <?syd letbs try a new
>     line ?>
>  norm-spc: <?syd letbs try a new line?>
> insrt-spc: <?syd  letbs try a new line?>
> insrt-nln: <?syd
> letbs try a new line?>
> --------- first 3 chars=bleab
>      copy: <?syd leading newline?>
>   copy-of: <?syd leading newline?>
>  proc-ins: <?syd leading newline?>
>  norm-spc: <?syd leading newline?>
> insrt-spc: <?syd  leading newline?>
> insrt-nln: <?syd
> leading newline?>
> </anOutermostElement>
>
> *APPENDIX C:* Output from Saxon:
> <?xml version="1.0" encoding="UTF-8"?><anOutermostElement>
> --------- first 3 chars=bnosb
>      copy: <?syd nospace?>
>   copy-of: <?syd nospace?>
>  proc-ins: <?syd nospace?>
>  norm-spc: <?syd nospace?>
> insrt-spc: <?syd nospace?>
> insrt-nln: <?syd nospace?>
> --------- first 3 chars=balrb
>      copy: <?syd already normalized space?>
>   copy-of: <?syd already normalized space?>
>  proc-ins: <?syd already normalized space?>
>  norm-spc: <?syd already normalized space?>
> insrt-spc: <?syd already normalized space?>
> insrt-nln: <?syd already normalized space?>
> --------- first 3 chars=blotb
>      copy: <?syd lots of     space    between  stuff   ?>
>   copy-of: <?syd lots of     space    between  stuff   ?>
>  proc-ins: <?syd lots of     space    between  stuff   ?>
>  norm-spc: <?syd lots of space between stuff?>
> insrt-spc: <?syd lots of space between stuff?>
> insrt-nln: <?syd lots of space between stuff?>
> --------- first 3 chars=bleab
>      copy: <?syd leading spaces and     tabs    between!?>
>   copy-of: <?syd leading spaces and     tabs    between!?>
>  proc-ins: <?syd leading spaces and     tabs    between!?>
>  norm-spc: <?syd leading spaces and tabs between!?>
> insrt-spc: <?syd leading spaces and tabs between!?>
> insrt-nln: <?syd leading spaces and tabs between!?>
> --------- first 3 chars=bletb
>      copy: <?syd letbs try a new
>     line ?>
>   copy-of: <?syd letbs try a new
>     line ?>
>  proc-ins: <?syd letbs try a new
>     line ?>
>  norm-spc: <?syd letbs try a new line?>
> insrt-spc: <?syd letbs try a new line?>
> insrt-nln: <?syd letbs try a new line?>
> --------- first 3 chars=bleab
>      copy: <?syd leading newline?>
>   copy-of: <?syd leading newline?>
>  proc-ins: <?syd leading newline?>
>  norm-spc: <?syd leading newline?>
> insrt-spc: <?syd leading newline?>
> insrt-nln: <?syd leading newline?>
> </anOutermostElement>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/782854> (by
> email <>)
>


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

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.