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 (those n elements text content prefix of current element's first path child)
  • and finally, not(...) true if node set empty, i.e. current path 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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -