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

RE: how to reserve single space after transformation

Subject: RE: how to reserve single space after transformation
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 5 Mar 2007 21:35:50 -0000
RE:  how to reserve single space after transformation
Your stylesheet says

<xsl:strip-space elements="*"/>

So the space has gone because you asked for it to be stripped.

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

> -----Original Message-----
> From: Lin, Jessica [mailto:jlin@xxxxxxxxxxx] 
> Sent: 05 March 2007 21:28
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  how to reserve single space after transformation
> 
> Here is example for XML file.
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <apg>
>   <channel_object>
>     <element1>test1</element1>
>     <element2>test2</elemetn1>
>   </channel_object>
>   <category_system_object>
>     <category_label>
> 	<string> </string>
>     </category_label>
>   </category_system_object>	
> </apg>
> 
> 
> Here is my XSLT file.
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
> 
> <xsl:output method="xml" version="1.0" encoding="UTF-8" 
> indent="no"/> <xsl:strip-space elements="*"/>
> 
> <xsl:template match="/ | node() | @* | comment() | 
> processing-instruction()">
>   <xsl:copy>
>     <xsl:apply-templates select="@* | node()"/>
>   </xsl:copy>
> </xsl:template>
> 
> 
> <xsl:template match="channel_object">
>   <advanced_channel_object>
>     <xsl:apply-template />
>   </advanced_channel_object>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> I strip out all white space in this transform since I will 
> call customized pretty-print XSLT later on the better print 
> (that is out of the scope of this problem).
> 
> 
> Thanks,
> Jessica
> -----Original Message-----
> From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> Sent: Monday, March 05, 2007 12:57 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  how to reserve single space after transformation
> 
> > 
> > I am doing XML to XML transform by using saxon 8. But the result 
> > changed from single space to empty space, could you please 
> help me for 
> > this problem?
> > 
> > <category_label>
> > 	<string> </string>
> > </category_label>
> > 
> > 
> > to: 
> > 
> > <category_label>
> > 	<string/>
> > </category_label>
> > 
> 
> I can think of many different stylesheets that would 
> transform a single space to a zero-length string, but the 
> chances are that none of them is the stylesheet you wrote. 
> Show us some code!
> 
> Michael Kay
> http://www.saxonica.com/

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.