[xsl] two nodes (or attributes) matching each other

Subject: [xsl] two nodes (or attributes) matching each other
From: Jarkko Moilanen <Jarkko.Moilanen@xxxxxx>
Date: Thu, 24 Apr 2003 09:46:41 +0300 (EEST)
Hi!

I am stuck here with fairly simple problem. And in my opinion this looks a
bit like grouping prob, but not sure about that. Anyways, what I want to
achieve here is to get the value of every user service
(/FINCCIS/User/Services/Service) when they match
with the similar service described in the system services
(/FINCCIS/Services/Service/@name)

Below is snippeds from my codes, XML ,XSL and current result.

Any suggestions?

Cheers,
Jarkko

*************************************************************************
XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FINCCIS>
// services attached this user = has permission to use service
<User>
 <Services>
  <Service>SitDisp</Service>
   <Service>XDoc</Service>
 </Services>
</User>

// All services in the system
<Services>
  <Service
     name="SitDisp"
     type="http"
     address="hypst09.uta.fi"
     port=":6969"
     command="/SituationDisplay.htm" />
  <Service
     name="XDoc"
     type="http"
     address="hypst09.uta.fi"
     port=":6969"
    command="/cbroker/XMLServ/XMLHan?command=showpage&amp;name=XDocTopUI"/>
</Services>
</FINCCIS>
**************************************************************************

XSLT:
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:output method="html"/>
<xsl:template match="/">
<html>
<xsl:for-each select="/FINCCIS/User/Services/Service">
  	<xsl:variable name="UserService" select="."/>

<xsl:for-each select="/FINCCIS/Services/Service/@name">
    	<xsl:variable name="FService" select="."/>


<xsl:for-each
select="/FINCCIS/User/Services/Service[$UserService=$FService]">
<p><xsl:value-of select="/FINCCIS/User/Services/Service"/></p>

</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</html>
</xsl:template>
</xsl:stylesheet>
***************************************************************************

CURRENT RESULT:
<html>
<p>SitDisp</p>
<p>SitDisp</p>
<p>SitDisp</p>
<p>SitDisp</p>
</html>


****************************************************************
Jarkko Moilanen          "Erehtyminen on inhimillista,
Researcher                mutta todella suuret mokat
jm60697@xxxxxx            vaativat tietokoneen käyttöä."
www.uta.fi/~jm60697
GSM: +358 50 3766 927
****************************************************************
* ITCM | Information Technology and Crisis Management
* http://www.itcm.org
****************************************************************






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


Current Thread