xml - exclude match based on node list -
first question on here bear me...
i'm confined xslt 1.0 via our cms :-/
trying create sitemap parsing xml xsl. but, need exclude several directories being displayed , don't want clutter syntax long piped| test statement....
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> **<!-- have tried param -->** <xsl:variable name="ppaths"> <n>/docs</n> <n>/files</n> </xsl:variable> <xsl:if test="not( starts-with(path, $ppaths) )"> <url> <loc>http://www.domain.com<xsl:value-of select="path"/></loc> <changefreq>monthly</changefreq> </url> </xsl:if>
in code above, if there 1 'n' element excludes properly. however, adding 2nd 'n' stops working entirely.
i've tried these other variations no luck:
test="not( starts-with(path, $ppaths/*) )" test="not( starts-with(path, exsl:node-list($ppaths)) )" test="not( starts-with(path, exsl:node-list($ppaths/*)) )"
something should work:
<xsl:if test="not(exsl:node-set($ppaths)/*[starts-with(current()/path, .)])">
$ppaths
variable containing result tree fragment 2 child element nodes.exsl:node-set($ppaths)
node set containing 1 node (the document fragment) has 2 child elements.exsl:node-set($ppaths)/*
node set containing 2 nodes (these 2 child elements).exsl:node-set($ppaths)/*[starts-with(current()/path, .)]
node set contain zero, 1 or 2 nodes (thosen
elements text content prefix of current element's firstpath
child)- and finally,
not(...)
true if node set empty, i.e. currentpath
not match of prefixes.
note /*
goes outside exsl:node-set(...)
because need first convert rtf node set , extract children - can't navigate rtf directly in xslt 1.0.
Comments
Post a Comment