[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|