Hi,
How about:
<xsl:variable name="keywords" select="('word1', 'word2', 'word3')"/>
<xsl:template match="item[description = $keywords]">
.. process the item ..
</xsl:template>
<xsl:template match="item">
.. do nothing ..
</xsl:template>
Cheers,
ac
I'm trying to filter an external rss feed using xls so that
only those feed items that contain at least one of a list of
words are selected. The code below does that, but I'm
wondering if there isn't a more succint and easier to
maintain way,
XSLT 1.0 isn't known for its succinctness.
In 2.0 I would do:
<xsl:variable name="keywords" as="xs:string*">
<w>word1</w>
<w>word2</w>
<w>word3</w>
</xsl:variable>
<xsl:function name="f:matches-keyword" as="xs:boolean">
<xsl:param name="in" as="xs:string"/>
<xsl:sequence select="some $w in $keywords satisfies contains($in, $w)"/>
</xsl:function>
<xsl:template match="item[f:matches-keyword(description)]">
.. process the item ..
</xsl:template>
<xsl:template match="item">
.. do nothing ..
</xsl:template>
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--