Folks,
I have an xml file that contains item elements. Some items have an
url attribute. I am trying to write a xslt program to give me each
url on a separate line. I figured this would work:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select=".//item[string-length(@url)!=0]"/>
</xsl:template>
<xsl:template match="item">
<xsl:value-of select="@url"/>
</xsl:template>
</xsl:stylesheet>
The problem with this is that there is no line breaking between the
different URL's. I tried adding both a and (forgetting
which one UNIX likes):
<xsl:template match="item">
<xsl:value-of select="@url"/>
</xsl:template>
And that still had no effect. Finally I tried to tack something on
the front and that DID work:
<xsl:template match="item">
:<xsl:value-of select="@url"/>
</xsl:template>
I could live with this except for the fact that there is no line on
the last entry so my shell script is not picking up the last entry.
How do I get a linefeed at the end?
Sam
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list