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

RE: why no indent here

Subject: RE: why no indent here
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Mon, 12 Dec 2011 07:59:56 +0000
RE:  why no indent here
Thanks,



But it don't work well. If I do the <xsl:text> then the sentence after that
will be without the line-break.

I think I have to live with it.



Another question :



When I have a xml piece of this :





<body>Naam : Tamara Wobben
         Geboorte gewicht : 2000 gram
         Geboorte lengte : 44 cm.
         Geboortedatum : 1 september 2005

</body>





And I do <xsl:value-of select="body" or I do <xsl:copy-of select="body"> Then
all the text will be displayed as this :



Tamara Wobben  Geboorte gewicht : 2000 gram Geboorte lengte : 44 cm
Geboortedatum : 1 september 2005



And not as the text in the xml file.



Can I display that text with a line break ?



Roelof











----------------------------------------
> Date: Sun, 11 Dec 2011 21:36:51 +0000
> From: tgraham@xxxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  why no indent here
>
> On Sun, December 11, 2011 8:18 pm, Roelof Wobben wrote:
> ...
> > But I get as output this :
> >
> > <!DOCTYPE head PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><head>
> > <title>http://test.tamarawobben.nl</title>
> > </head>
> >
> > instead of this :
> >
> > <!DOCTYPE head PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> >
> > <head>
> > <title>http://test.tamarawobben.nl</title>
> > </head>
>
> Whitespace-only text nodes in the stylesheet are stripped by default.
> From http://www.w3.org/TR/xslt#strip:
>
> For stylesheets, the set of whitespace-preserving element
> names consists of just xsl:text.
>
> So if you were expecting whitespace-only text nodes from your stylesheet
> to be reflected in your result, you need to wrap them in xsl:text
> elements.
>
> All that XSLT 1.0 says about '<xsl:output indent="yes" />' is:
>
> indent specifies whether the XSLT processor may add
> additional whitespace when outputting the result tree;
> the value must be yes or no [1]
>
> so you're not even guaranteed to get an indented result even when you use
> 'indent="yes"' (but it practice it is universally supported AFAICT).
>
> The specification for outputting the DOCTYPE declaration in XML output is:
>
> If the doctype-system attribute is specified, the xml
> output method should output a document type declaration
> immediately before the first element.
>
> which is what you got, since the start-tag of the first element
> immediately follows the DOCTYPE declaration. You could try:
>
> <xsl:template match="/">
> <xsl:text>&#10;</xsl:text>
> <xsl:apply-templates select="data/params" />
> </xsl:template>
>
> but it would be possible for the XSLT 1.0 processor to follow the letter
> of the spec and omit the line break added from content of the xsl:text, so
> YMMV.
>
> Regards,
>
>
> Tony Graham tgraham@xxxxxxxxxx
> Consultant http://www.mentea.net
> Mentea 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> XML, XSL-FO and XSLT consulting, training and programming
>
> [1] http://www.w3.org/TR/xslt#output

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.