exclude match based on node list

First question on here so bear with me...

I'm confined to XSLT 1.0 via our CMS :-/

Trying to create a SiteMap parsing XML with XSL. But, I need to exclude several directories from being displayed and really don't want to clutter the syntax with a 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">

<xsl:variable name="pPaths">

<xsl:if test="not( starts-with(path, $pPaths) )">  
        <loc>http://www.domain.com<xsl:value-of select="path"/></loc>

In the code above, if there is only 1 'n' element it excludes properly. However, adding the 2nd 'n' stops it from working entirely.

I've also tried these other variations with 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 like this should work:

<xsl:if test="not(exsl:node-set($pPaths)/*[starts-with(current()/path, .)])">
  • $pPaths is a variable containing a result tree fragment with two child element nodes.
  • exsl:node-set($pPaths) is a node set containing one node (the document fragment) which has two child elements.
  • exsl:node-set($pPaths)/* is a node set containing two nodes (these two child elements).
  • exsl:node-set($pPaths)/*[starts-with(current()/path, .)] is a node set that will contain zero, one or two nodes (those n elements whose text content is a prefix of the current element's first path child)
  • and finally, not(...) is true if that node set is empty, i.e. the current path does not match any of the prefixes.

Note that the /* goes outside the exsl:node-set(...) because you need to first convert the RTF to a node set and only then extract its children - you can't navigate from an RTF directly in XSLT 1.0.

Need Your Help

Append Histogram Class Objects to a list elements in R

r list class histogram

My title's problem is very similar to a lot of's in SOF, though my problem is very different :

jQ: Parse localstorage & stringify values

javascript jquery json local-storage stringify

I am storing some values in localStorage using stringify and I'm trying to parse them but it doesn't work for me.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.