|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: string split
> bash$ sed -e "s@\\([0-9]\\)\\,*@<a
> href='#id\\1'>\\1</a>\\&nspb;@g" dp5.xml
> <doc>
> <elem><a href='#id5'>5</a>&nspb;<a href='#id6'>6</a>&nspb;<a
> href='#id7'>7</a>&nspb;</elem>
> </doc>
I've never seen modem noise on email before!
Jarno Elovirta and Don Bruey both provided an answer off-list,
which had a far better signal to noise ratio.
I had 'forgotten' that I can output content from the named
template :-| I was trying to collect it into a variable in
the calling template. Live and learn.
DaveP
Jarno's solution:
<xsl:template match="doc/elem">
<body>
<xsl:call-template name="links">
<xsl:with-param name="str" select="."/>
</xsl:call-template>
</body>
</xsl:template>
<xsl:template name="links">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str,',')">
<a href="#id{substring-before($str,',')}"><xsl:value-of
select="substring-before($str,',')"/></a>
<xsl:text> </xsl:text>
<xsl:call-template name="links">
<xsl:with-param name="str" select="substring-after($str,',')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<a href="#id{$str}"><xsl:value-of select="$str"/></a>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








