selection from a node-list

Discussion in 'XML' started by Keith Davies, Sep 14, 2004.

  1. Keith Davies

    Keith Davies Guest

    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
    --
    Keith Davies

    "Some do and some don't. I *hate* that kind of problem."
    "Understandable. Consistency is important with **** ups."
    Keith Davies, Sep 14, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,411
  2. Simon Niederberger
    Replies:
    2
    Views:
    16,444
    Christian Kaufhold
    Jan 7, 2005
  3. Tjerk Wolterink
    Replies:
    2
    Views:
    1,403
    Dimitre Novatchev
    Aug 24, 2006
  4. sangram
    Replies:
    16
    Views:
    1,966
  5. curiousity

    HOWTO autopost the selection list upon selection

    curiousity, Nov 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    260
    curiousity
    Nov 21, 2003
Loading...

Share This Page