RE: [xsl] pattern matching in xslt

Subject: RE: [xsl] pattern matching in xslt
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Apr 2002 15:24:36 -0600
At 03:01 PM 4/23/2002, you wrote:
Regarding exslt, I don't think I can implement anything but the default
Xalan, IBM XML for Java packages. Thanks just the same!

The stuff at exslt.org are ordinary templates. I assume that Xalan can execute an XSL template.


[time passes]

I just completed your request; here is your XSL stylesheet. You will need to modify the path to reflect Xalan's namespace and (I assume it has this) its node-set extension function. I used MSXSL so you can delete those references.

<?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" xmlns:str="http://www.exslt.org/str"; extension-element-prefixes="msxsl str">
<xsl:import href="strings.xsl" xmlns="http://www.exslt.org/str"/>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="description">
<xsl:element name="result">
<xsl:variable name="tokens">
<xsl:call-template name="str:tokenize">
<xsl:with-param name="string" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="token-node-set" select="msxsl:node-set($tokens)"/>
<xsl:for-each select="$token-node-set/*[. != '..']">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:value-of select="' '"/>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>



Greg Faron Integre Technical Publishing Co.



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread