[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Xsl:strip-space and xsl:preserve-space (XSLT 2.0)

Subject: RE: Xsl:strip-space and xsl:preserve-space (XSLT 2.0)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 24 Sep 2008 14:05:37 +0100
RE:  Xsl:strip-space and xsl:preserve-space (XSLT 2.0)
I believe it's true that the AltovaXML processor always strips whitespace
nodes (or calls the MSXML parser in a way that strips them) and I'm not
aware of any way of changing this.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Pankaj Chaturvedi [mailto:pankaj.chaturvedi@xxxxxxxxx] 
> Sent: 24 September 2008 09:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Xsl:strip-space and xsl:preserve-space (XSLT 2.0)
> 
>  
> 
> What XML parser and XSLT processor are you using?
> 
> 
> Just for curiosity Michael, is this related with XSLT 
> processor or there is error in my code.
> 
> Thanks for help.
> 
> Pankaj
> 
> 
> 
> 
> > -----Original Message-----
> > From: Pankaj Chaturvedi [mailto:pankaj.chaturvedi@xxxxxxxxx]
> > Sent: 23 September 2008 23:52
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  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.
> > 
> > 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?
> > 
> > Below is how they looks in my stylesheet:
> > 
> > Snippet
> > =======
> > 
> > <xsl:stylesheet version="2.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:fn="http://www.w3.org/2005/xpath-functions">
> > 
> > <xsl:strip-space elements="*"/>
> > 
> > <xsl:preserve-space elements="element1 element2"/>
> > 
> > <xsl:output encoding="UTF-8" indent="no" media-type="text/xml"
> > method="xml"/>
> > 
> > --------------
> > --------------
> > --------------
> > --------------
> > --------------
> > 
> > </xsl:stylesheet>
> > 
> > 
> > Example:
> > 
> > <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>&ndash;<last-page>46</last-page>.</
> > element1>
> > 
> > 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> )
> > 
> > 
> > Below is how I have defined template for "element1"
> > 
> > <xsl:template match="element1">
> >     <xsl:apply-templates/>
> > </xsl:template>
> > 
> > Any suggestion would be an immense help.
> > 
> > 
> > Best,
> > 
> > Pankaj Chaturvedi
> > 
> > ==============================================================
> > ==============
> > ================
> > 
> > 
> > Confidentiality Notice:" This message and any attachment(s) 
> contained 
> > here are information that is confidential, proprietary to 
> IDS Infotech 
> > Ltd. and its customers.
> > Contents may be privileged or otherwise protected by law. The 
> > information is solely intended for the individual or the 
> entity it is 
> > addressed to. If you are not the intended recipient of this 
> message, 
> > you are not authorized to read, forward, print, retain, copy or 
> > disseminate this message or any part of it. If you have 
> received this 
> > e-mail in error, please notify the sender immediately by 
> return e-mail 
> > and delete it from your computer."

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.