[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: AW: two nodes (or attributes) matching each other

Subject: Re: AW: two nodes (or attributes) matching each other
From: Jarkko.Moilanen@xxxxxx
Date: Mon, 28 Apr 2003 08:11:05 +0300
xdoc moilanen
Lainaus "Zink, Juergen" <Juergen.Zink@xxxxxxxxxxxxxxxxxxxx>:

| Hi Jarkko,
| 
| my suggestion:
| 
|   <xsl:for-each
| select="/FINCCIS/User/Services/Service[.=/FINCCIS/Services/Service/@name]">
|     <p><xsl:value-of select="."/></p>
|   </xsl:for-each>
| 
| instead of all the other foreach loops. Just inside the html-tag.
| 

Ok, I chose this approach and it worked fine for matching the equal nodes. 
Then I tryed to do the same for the nodes that dont match each other:

 <xsl:for-each
 select="/FINCCIS/User/Services/Service[.!=/FINCCIS/Services/Service/@name]">
     <p><xsl:value-of select="."/></p>
 </xsl:for-each>


Now the problem is that when these two are combined in the template to be 
applied the list of collection is not exactly the one wanted. 

<xsl:for-each select="/XDoc/Editable/XDocUser/UserProfile/Services/Service
[.=/XDoc/Services/Service/@name]">
	<input type="checkbox" checked="checked"  name="service"
value="{.}"><xsl:value-of select="."/></input>
	<br/>
	</xsl:for-each>
	
<xsl:for-each select="/XDoc/Services/Service/@name
[.=/XDoc/Editable/XDocUser/UserProfile/Services/Service/node()='']">
	<input type="checkbox" name="service" value="{.}"><xsl:value-of
select="."/></input>
	<br/>
	</xsl:for-each>	

This would produce list of items were the list of similar values is correct,
Yes, so far so good. BUT in the latter part of my xslt code, the nodes (or
their values to be more exact) with similar are also included to the list. 

Aah, but then it came to my mind. I have to test whether the element to
compare with exists at all (or is empty). So since I saw the worth to write
this far, here is what was the answer:

<!-- To get the nodes that dont match -->
<xsl:for-each select="/XDoc/Services/Service/@name
[.=/XDoc/Editable/XDocUser/UserProfile/Services/Service/node()='']">
<input type="checkbox" name="service" value="{.}"><xsl:value-of
select="."/></input>
	<br/>
	</xsl:for-each>	

Other more simple solutions?

Cheers, 
Jarkko 


***************************************************
* Jarkko Moilanen                                 *
* Project Researcher, ITCM (www.itcm.org)         *
* Profound XML technology Expert                  *
* University of Tampere                           *
* Hypermedia Laboratory                           *
***************************************************

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.