At 2013-04-18 11:07 +0000, trond(_dot_)huso(_at_)ntb(_dot_)no wrote:
For some reason when using mode the indentation and line breaks are
all removed:
The specification states that white-space-only text nodes in the
stylesheet are not included when stylesheet nodes are copied to the
result tree. This includes those nodes used for indentation in the stylesheet.
This is the initiater:
<xsl:template match="/" mode="run2">
<nitf version="-//IPTC//DTD NITF 3.2//EN"
change.date="October 10, 2003" change.time="19:30"
baselang="no-NO">
<!-- Call template header -->
<xsl:call-template name="header" />
<body>
<xsl:call-template name="body3"/>
</body>
</nitf>
</xsl:template>
Output:
<?xml version="1.0" encoding="UTF-8"?><nitf
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ckbk="http://my.safaribooksonline.com/book/xml/0596009747/dates-and-times/"
version="-//IPTC//DTD NITF 3.2//EN" change.date="October 10, 2003"
change.time="19:30" baselang="no-NO"><head><title>Langoddstips uke
16</title><meta name="timestamp" content="2013.4.18 12:52:50"/>
That is showing the result with the text nodes of the stylesheet
properly ignored.
I have this in the "global" area of xslt:
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1" name="xml" />
That *should* have added some white-space to your result, but the
processor is allowed to ignore indent="yes" and still be considered
conformant. If your processor is not supporting indenting the result
serialization, you would have to go through elaborate means to
preserve the white-space nodes in your stylesheet.
Any suggestions?
Which processor are you using? Does that processor support indent="yes"?
Sometimes keeping stylesheet template indentation is as simple as
adding xml:space="preserve" in the template rule, but often it isn't
that simple.
Is there a reason why you want it preserved? It usually isn't
important to the downstream processor. I advise my students that
indent="yes" may be useful in development but it should be
indent="no" in a production environment if you are unsure of what
white-space is being added in all circumstances. For example, having
indent="yes" has hurt me in production work with XSL-FO.
I hope this helps.
. . . . . . . . . Ken
--
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ |
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
|
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers: http://www.CraneSoftwrights.com/legal |
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--