 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 17th, 2008, 05:52 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
variable space deleting between the tags
dear sir
in my xslt, i want to convert this xml file, but in the output file i am not getting the space between "</xref> <italic>"
"<xref ref-type="bibr" rid="b4">Ferguson (1995)</xref> <italic>Essay on the History of Civil Society</italic>"
please help me
thanks
Rajashekhara
|
|

December 17th, 2008, 06:25 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
I suspect you are using a Microsoft parser (or possibly the Altova product, which mimics Microsoft). This parser defaults to removing whitespace text nodes before the transformation starts. There are API options to inhibit this behaviour (sorry, I don't remember the details) when loading the XML document into memory. Unfortunately there's no way of doing so if the transformation is initiated using the xml-stylesheet processing instruction.
If you have the option to do so, the simplest solution is to use a different XSLT processor.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

December 17th, 2008, 06:36 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
dear sir,
i am using saxon 8, on windows.
thanks
rajashekhara
|
|

December 17th, 2008, 06:41 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
In that case please show a complete (but minimal!) source document and stylesheet to illustrate the problem. Perhaps you're just not copying the space to the output.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

December 17th, 2008, 07:07 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
actually i am trying to convert xml file to latex file, here is the xsl and xml code
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output use-character-maps="iso9573-2003" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="xref">
<xsl:text>\authorcite{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="italic">
<xsl:text>\textit{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>
XML:
<fn id="fn5"><label>5</label><p>See, e.g., 1, p 279; <xref ref-type="bibr" rid="b4">Ferguson (1995)</xref> <italic>Essay on the History of Civil Society</italic>, I.5, pp 30–1.</p></fn>
thanks
Rajashekhara
|
|

December 17th, 2008, 07:17 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
The whitespace is being removed from the input because you have asked for it to be removed, by writing
<xsl:strip-space elements="*"/>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|
The Following User Says Thank You to mhkay For This Useful Post:
|
|
|
 |