Subject: Fwd: Re: [xsl] Xsl:strip-space and xsl:preserve-space (XSLT 2.0) From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 24 Sep 2008 09:01:04 -0700 |
Date: Tue, 23 Sep 2008 16:55:55 -0700 To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Subject: Re: [xsl] Xsl:strip-space and xsl:preserve-space (XSLT 2.0)
In my stylesheet, I am stripping all the spaces, new line character while using <xsl:strip-space elements="*"/> which works perfectly as desired.
T:\ftemp>type pankaj.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
</xsl:stylesheet> T:\ftemp>type pankaj.xml <element1><surname>Dajnoki</surname>, <givenname>K.</givenname> (<year>2002</year>) <article-title>XXXXX YYYY</article-title>. <journal-title>ZZZZZZ XXXX</journal-title> <first-page>43</first-page>-<last-page>46</last-page>.</element1>
T:\ftemp>saxon9 -strip:all pankaj.xml pankaj.xsl Dajnoki, K. (2002) XXXXX YYYY. ZZZZZZ XXXX43-46. T:\ftemp>saxon9 -strip:none pankaj.xml pankaj.xsl Dajnoki, K. (2002) XXXXX YYYY. ZZZZZZ XXXX 43-46. T:\ftemp>
But now I've come across the requirement where I need to preserve spaces between the tags in few specific elements generally the punctuations(see below example) I tried to use the <xsl:preserve-space> to sort out this issue but doesn't seems to be working
and "xsl:strip-space" seems to overcoming the effect of "xsl:preserve-space" effects. Can we use both to get their respective effects or simply they cannot be used together?
T:\ftemp>type pankaj2.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
</xsl:stylesheet> T:\ftemp>saxon9 -strip:none pankaj.xml pankaj2.xsl Dajnoki, K. (2002) XXXXX YYYY. ZZZZZZ XXXX43-46. T:\ftemp>type pankaj3.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
</xsl:stylesheet> T:\ftemp>saxon9 -strip:none pankaj.xml pankaj3.xsl Dajnoki, K. (2002) XXXXX YYYY. ZZZZZZ XXXX 43-46. T:\ftemp>
Note: Spaces between the tags with any punctuation appears correctly (like in <surname>Dajnoki</surname>, <givenname>K.</givenname>) but fails in case of a single space between tags > < (for instance in </journal-title> <first-page> and results into the </journal-title><first-page> )
-- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Elsevier contest, Wendell Piez | Thread | Re: Fwd: Re: [xsl] Xsl:strip-space , Colin Paul Adams |
[xsl] Elsevier contest, Wendell Piez | Date | Re: [xsl] Getting ant to tell me wh, Jonathan Robie |
Month |