This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
The comparison after inner for-each iterartion
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] The comparison after inner for-each iterartion
- From: Dan Diebolt <dandiebolt at yahoo dot com>
- Date: Tue, 1 May 2001 06:28:26 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Y> I am using two for loops for node comaparison.
I think you are trying to appraoch your problem as if XSLT
is a procedural language. Upon clarification of your question,
you may find you don't need any 'for loops'.
Y> <Xml>
Realize you cannot have a tag starting Xml was it is reserved.
Y> In my output I want to do like: If <Name> child from <Personnel>
Y> node has same value of ' first' attribute
Y> as in Prof/Name then Personnel/Name will not be written to output.
I don't quite see the utility of what you are attempting, but I
read your problem to be as follows: output each Prof/Name unless
there is a Personnel/Name with the same first name. As a preliminary
step towards a solution, the attached files output each Prof/Name
and a message if there is a Personnel/Name with the same frist
name. Could you clarify the logic you want to see and give an
example of the output?
Also, I added <Name first="Mery" last="John" /> to <Personnel> and
produce the following output with that attached files:
Prof: Joe, Mery
There is a corresponding individual in Personnel with the same first name.
Prof: Bush, Andrew
Regards,
Dan
File:Personnel1May2001
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Personnel1May2001.xsl"?>
<Info>
<Personnel>
<Name first="Peter" last="Golf" />
<Name first="Alex" last="John" />
<Name first="Mery" last="John" />
</Personnel>
<Prof>
<Name first="Mery" last="Joe" />
<Name first="Andrew" last="Bush" />
</Prof>
</Info>
File: Personnel1May2001.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Info/Prof/Name">
Prof: <xsl:value-of select="@last"/>,
<xsl:value-of select="@first"/><br/>
<xsl:if test="@first=../../Personnel/Name/@first">
There is a corresponding individual in Personnel
with the same first name.<br/>
</xsl:if>
<br/>
</xsl:template>
</xsl:stylesheet>
<Prof>
<Name first="Mery" last="Joe" />
<Name first="Andrew" last="Bush" />
</Prof>
</Info>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list