Hi,
Use this xsl file:
<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/Services/Service/@name">
<xsl:variable name="FService" select="."/>
<xsl:for-each
select="/FINCCIS/User/Services/Service[.=$FService]">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</xsl:for-each>
</html>
</xsl:template>
</xsl:stylesheet>
regards,
sundar
-----Original Message-----
From: Jarkko Moilanen [mailto:Jarkko(_dot_)Moilanen(_at_)uta(_dot_)fi]
Sent: Thursday, April 24, 2003 12:17 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] two nodes (or attributes) matching each other
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&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(_at_)uta(_dot_)fi 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list