Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 17th, 2008, 05:52 AM
Authorized User
 
Join Date: Jul 2008
Location: bangalore, , India.
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
Reply With Quote
  #2 (permalink)  
Old December 17th, 2008, 06:25 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
  #3 (permalink)  
Old December 17th, 2008, 06:36 AM
Authorized User
 
Join Date: Jul 2008
Location: bangalore, , India.
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default

dear sir,

i am using saxon 8, on windows.


thanks
rajashekhara
Reply With Quote
  #4 (permalink)  
Old December 17th, 2008, 06:41 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
  #5 (permalink)  
Old December 17th, 2008, 07:07 AM
Authorized User
 
Join Date: Jul 2008
Location: bangalore, , India.
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
Reply With Quote
  #6 (permalink)  
Old December 17th, 2008, 07:17 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
jminatel (December 29th, 2008)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.