Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old December 17th, 2008, 05:52 AM
Authorized User
 
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default 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
 
Old December 17th, 2008, 06:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old December 17th, 2008, 06:36 AM
Authorized User
 
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default

dear sir,

i am using saxon 8, on windows.


thanks
rajashekhara
 
Old December 17th, 2008, 06:41 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old December 17th, 2008, 07:07 AM
Authorized User
 
Join Date: Jul 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default

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&ndash;1.</p></fn>

thanks
Rajashekhara
 
Old December 17th, 2008, 07:17 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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:
jminatel (December 29th, 2008)





Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding deleting tags in an xml abhi.prince4u XML 0 July 14th, 2007 12:16 AM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
put a space in between each variable crmpicco Javascript How-To 1 June 7th, 2005 11:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.