I am creating some xsl to convert my xml to text (which will eventually be csv). I am using VS2008. When I use the editor to create xsl, the converted output is indented according to my xsl. However, if I edit xsl and remove the formatted spaces, it displays correctly, but to do it as if it were a nightmare to work with.
Are there some xsl pre-processor commands or markup that I can enable to prevent this? I want to ignore any spaces in my xsl and only output text with <!CDATA[]]>or <xsl:text>.
My XSL looks like this: it's indented output
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="text" indent="no"/>
<xsl:template match="/">
<xsl:text>CSV Output</xsl:text>
<xsl:for-each select="//rows/row">
<![CDATA[row id=]]><xsl:value-of select="(@id)"/>
</xsl:for-each>
<![CDATA[<EOF>]]>
</xsl:template>
</xsl:stylesheet>
The result of this is as follows:
CSV Output
row id=0
row id=1
<EOF>
However, the following outputs are correct:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="text" indent="no"/>
<xsl:template match="/">
<xsl:text>CSV Output</xsl:text>
<xsl:for-each select="//rows/row">
<![CDATA[row id=]]><xsl:value-of select="(@id)"/>
</xsl:for-each>
<![CDATA[<EOF>]]>
</xsl:template>
</xsl:stylesheet>
This is correctly displayed as follows:
CSV Output
row id=0
row id=1
<EOF>
, . xsl , .
, !
,
Andez