Subject: RE: [xsl] Xsl:strip-space and xsl:preserve-space (XSLT 2.0)|
From: "Pankaj Chaturvedi" <pankaj.chaturvedi@xxxxxxxxx>
Date: Wed, 24 Sep 2008 18:48:56 +0530
Not a good news for me. Well anyways David/Michael thanks for looking into this. Best, Pankaj Chaturvedi ============================================================================ ================ -----Original Message----- From: Michael Kay [mailto:mike@xxxxxxxxxxxx] Sent: Wednesday, September 24, 2008 6:36 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] 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] 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] 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>–<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."