Subject: Re: [xsl] Outputting White Space Only Nodes from Variables From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 23 Feb 2021 19:53:41 -0000 |
Hi again, White space ... <xsl:variable name="generatedTextAfter" as="xs:string" xml:space="preserve"> </xsl:variable> Not exactly sure what advantage it gives here, but this is handy to be able to do. (I wouldn't use it for a space, but I might use it for a chunk of CSS.) Cheers, Wendell On Mon, Feb 22, 2021 at 8:20 AM Don Smith dsmith_lockesmith@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > Thank you both, Liam and Wendell. After Liam's reference to the relevant > part of the spec I checked it and realized the <xsl:text> approach would > work and had my obligatory "D'oh!" moment. I think I'll use that as I find > it more legible. > > Don > > On Monday, February 22, 2021, 06:40:34 AM CST, Wendell Piez > wapiez@xxxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > > Hi, > > You could also have: > > <xsl:variable name="generatedTextAfter" as="xs:string?"><xsl:text> > </xsl:text></xsl:variable> > > The deal is that directly inside that xsl:variable, a whitespace-only text > node in the XSLT is considered to be 'cosmetic' and dropped. So there is no > space to be placed into the result. > > Adding xsl:text forces the text node, which is then cast to a string > following the @ as . > > (What are those robots doing to my notation?) > > Cheers, Wendell > > > On Mon, Feb 22, 2021 at 12:07 AM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx < > xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > On Mon, 2021-02-22 at 02:14 +0000, Don Smith > dsmith_lockesmith@xxxxxxxxx wrote: > > > > 1. Use different instructions for the output of the variable: value- > > of, copy-of, and sequence2. Created the variables as both strings and > > elements and even RTFs3. Tried a character map4. Tried an alternative > > approach like using strings "#SPACE, #TAB, #NL, etc. I know that > > would work but seems like it should be unnecessary? > > In every case the white space only variable content gets stripped > > out. How can such content be output? > > I tried, > <xsl:variable name="generatedTextAfter" as="xs:string?" select=" ' ' > "/> > and got output. > > > The relevant text in the spec is this: > https://www.w3.org/TR/xslt-30/#stylesheet-stripping > > Liam > > -- > Liam Quin, https://www.delightfulcomputing.com/ > Available for XML/Document/Information Architecture/XSLT/ > XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. > Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org > > > > > -- > ...Wendell Piez... ...wendell -at- nist -dot- gov... > ...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org... > ...github.com/wendellpiez... ...gitlab.coko.foundation/wendell... > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/997972> (by > email) > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by > email <>) > -- ...Wendell Piez... ...wendell -at- nist -dot- gov... ...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org... ...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Outputting White Space On, Don Smith dsmith_loc | Thread | Re: [xsl] Outputting White Space On, Bauman, Syd s.bauman |
Re: [xsl] How can the mere switch f, Wolfhart Totschnig w | Date | [xsl] Apply Comment Position, Byomokesh Sahoo saho |
Month |