Re: [xsl] Re: Initial whitespace in PI from XSLT, appendices
2022-05-07 16:51:54
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(_dot_)bauman(_at_)northeastern(_dot_)edu <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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 let’s try a new
line ?>
<?syd
leading newline?>
<xsl:template match="/">
<anOutermostElement>
<xsl:text>
</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('‘', substring( ., 1, 3 ), '’')"/>
<!-- Try copying to output: -->
<xsl:text>
 copy: </xsl:text>
<xsl:copy/>
<!-- I expect this different way of expressing "copy this" to do the
same thing: -->
<xsl:text>
 copy-of: </xsl:text>
<xsl:copy-of select="."/>
<!-- Construct a new processing instruction based on the input: -->
<xsl:text>
 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>
 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>
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>
insrt-nln: </xsl:text>
<xsl:processing-instruction name="{name(.)}">
<xsl:value-of select="concat('
', normalize-space(.) )"/>
</xsl:processing-instruction>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
*APPENDIX B:* Output from `xsltproc`
<?xml version="1.0"?>
<anOutermostElement>
--------- first 3 chars=‘nos’
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=‘alr’
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=‘lot’
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=‘lea’
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=‘let’
copy: <?syd let’s try a new
line ?>
copy-of: <?syd let’s try a new
line ?>
proc-ins: <?syd let’s try a new
line ?>
norm-spc: <?syd let’s try a new line?>
insrt-spc: <?syd let’s try a new line?>
insrt-nln: <?syd
let’s try a new line?>
--------- first 3 chars=‘lea’
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=‘nos’
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=‘alr’
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=‘lot’
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=‘lea’
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=‘let’
copy: <?syd let’s try a new
line ?>
copy-of: <?syd let’s try a new
line ?>
proc-ins: <?syd let’s try a new
line ?>
norm-spc: <?syd let’s try a new line?>
insrt-spc: <?syd let’s try a new line?>
insrt-nln: <?syd let’s try a new line?>
--------- first 3 chars=‘lea’
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.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [xsl] Initial whitespace in PI from XSLT, main body, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu
- [xsl] Re: Initial whitespace in PI from XSLT, appendices, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu
- Re: [xsl] Re: Initial whitespace in PI from XSLT, appendices,
Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com <=
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Michael Kay mike(_at_)saxonica(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Bauman, Syd s(_dot_)bauman(_at_)northeastern(_dot_)edu
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Wendell Piez wapiez(_at_)wendellpiez(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Wendell Piez wapiez(_at_)wendellpiez(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com
- Re: [xsl] Initial whitespace in PI from XSLT, main body, Michael Kay mike(_at_)saxonica(_dot_)com
|
|
|