Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] how to reserve single space after transformation

From: "Lin, Jessica" <jlin@----------->
To:
Date: 3/5/2007 9:28:00 PM
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: [xsl] 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent