selection from a node-list

K

Keith Davies

Hi All,

In my web page generation, I want to be able to automatically split
(create a new page) on nodes that meet certain criteria. One is if the
'out:split' attribute is set to 'yes' (dead easy to pick out), another
is that the qualified element name appears on a 'split on these
elements' list.

Given the list of automatic splits, it is easy to determine whether a
particular node is present on that list:

<xsl:variable name='uri' select=namespace-uri()' />
<xsl:variable name='name' select='local-name()' />
<xsl:if test='@out:split="yes" or $splits[../@uri = $uri][@name = $name]'>

On the other hand, it is simpler if I can build a list of all nodes to
split on, then I can do:

<xsl:if test='count(.|$split-nodes) == count($split-nodes)'>

and I won't need to create the variables, etc. Creating variables isn't
a big deal, but this is much simpler code, especially if I change the
criteria for determining whether a particular node should be split on.

All I need at this point is a way to produce $split-nodes.

<xsl:variable name='split-nodes'
select='//*[ @out:split="yes" or
$splits[../$uri=namespace-uri()][@name=local-name()]]' />

doesn't work for me. I can't use $uri and $name variables as the first
case because I don't have a current element to create them with. As a
result, namespace-uri(current()) doesn't work either, of course.

Is there a way to get XSLT to present me with "a list of all nodes such
that @out:split="yes" or there exists an element in $splits that has
@uri and @name attributes matching the namespace-uri() and local-name()
of the nodes"?


Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top