xml - XSLT newline not working in MS Build task -
i'm trying transform xml file textfile ms build xsltransformationtask (https://msdn.microsoft.com/en-us//library/ff598688.aspx).
my problem can print new lines if combine them other (non-space) text. example <xsl:text> </xsl:text>
not produce newline, <xsl:text> sampletext</xsl:text>
does. tried other variants <xsl:text>
</xsl:text>
, <xsl:text>
</xsl:text>
same result.
ms build task:
<target aftertargets="build" name="test"> <xsltransformation xslinputpath="config.xslt" xmlinputpaths="config.schema.xml" outputpaths="out.txt" /> </target>
xslt doc:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method='text' /> <xsl:template match="/root/properties"> <xsl:for-each select="./*"> <!--working new line character:--> <xsl:text> name: </xsl:text> <xsl:value-of select="name(.)" /> <!--not working:--> <xsl:text> </xsl:text> </xsl:for-each> </xsl:template> <xsl:template match="text()" /> </xsl:stylesheet>
hope helps
<xml> <property>1</property> <property>2</property> <property>3</property> </xml>
sample xsl
<?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method='text' /> <xsl:template match="/"> <xsl:for-each select='//property'> <xsl:if test='position() > 1 '><xsl:text>
</xsl:text></xsl:if> <xsl:value-of select='.'/> </xsl:for-each> </xsl:template>
creates
1 2 3
Comments
Post a Comment