RE: saving a node in a variable

Subject: RE: saving a node in a variable
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Sun, 14 Nov 1999 21:08:43 -0700
Natalie Rooney wrote:
> The attributes are child nodes, such as:
>
> <NEWUSER>
>     <FIRSTNAME> </FIRSTNAME>
>     <LASTNAME> </LASTNAME>
>    etc...
> </NEWUSER>

Then please don't refer to them as attributes. Call them, uh, 'properties'
or something when you are saying what they mean. When you tell us what they
*are*, call them child elements.

> Is there any way to assign a node set to a
> variable, so that I could do something like:
> 
> <xsl:for-each select="//BADUSER">
> <xsl:variable name="badNode" select= [current node]/>

select="."

> Could this be done using keys?
> [...]
> Note that the baduser selections have to be done inside the
> <xsl:for-each select="//NEWUSER/*"> loop, becuase the
> attributes have to line up.

Keys could provide a way for you to say $badNode/*[name()=$tagName] a little
more easily, and they'd help in that you could use them to avoid having to
iterate through the BADUSERs to find the ones you want.

Your output requirements are hard to follow, without knowing what the source
data looks like. As someone else mentioned, provide some sample data that
illustrates the basic principles.

You said (sorta) that you want an HTML table with 4 columns:

1. names of child elements common to both NEWUSER and BADUSER
2. text node children of those elements for NEWUSERs
3. a 'score' attribute value coming from somewhere
4. text node children of elements with the same name for BADUSER

If I read right, for each BADUSER, you are wanting to see a comparison of
that BADUSER element's child elements to ...? Those with the same names that
are child elements of *every* NEWUSER? Or of just one of them? Which ones?
You don't really say how you're determining which NEWUSERs and BADUSERs are
being compared, or where the 'score' attribute comes from. Once that is
known, someone can give you more productive advice.

-Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread