This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Getting the attribute of a node knowing the value of other attribute
- From: "Monica Ferrero" <monica dot ferrero at marconi dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 29 May 2002 14:41:29 +0100
- Subject: [xsl] Getting the attribute of a node knowing the value of other attribute
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello!
I am transforming an XML file to LDIF format.
I am trying to get the name of the Subnetwork knowing its id when I am in
the trail object:
Here you can see the XML (it is fixed):
<Layer id="443__2_2" name="VC4" signalType="VC4">
<Subnetwork id="342__2_2_1" name="M" >
...
</Subnetwork>
<Subnetwork id="342__2_2_2" name="T">
</Subnetwork>
<TrailList id="344__2_2_17" nsueName="M<->C" >
<TopologicalEndPoints>
<TopologicalEndPointA>
<SubnetworkRef idref="342__2_2_1"/>
</TopologicalEndPointA>
<TopologicalEndPointZ>
<SubnetworkRef idref="342__2_2_4"/>
</TopologicalEndPointZ>
</TopologicalEndPoints>
<Trail id="355__2_2_17_1" nsueName="M<->C[1]" >
</Trail>
</TrailList>
The XSL:
<xsl:template match="Trail">
dn: cn=<xsl:value-of select="@name"/>, cn=<xsl:value-of select="../../../../@name"/>, cn=Connectivity
objectclass: mTrail
cn: cn=<xsl:value-of select="@name"/>
id: <xsl:value-of select="@id"/>
subnetworkA: <xsl:value-of select="../TopologicalEndPoints/TopologicalEndPointA/SubnetworkRef/@idref"/>
subnetworkA: <xsl:value-of select="../../Subnetwork[@id='342__2_2_1']/@name"/>
subnetworkA: <xsl:value-of select="../../Subnetwork[@id='{../TopologicalEndPoints/TopologicalEndPointA/SubnetworkRef/@idref}']/@name"/>
</xsl:template>
The result of:
subnetworkA: <xsl:value-of select="../TopologicalEndPoints/TopologicalEndPointA/SubnetworkRef/@idref"/>
is
342__2_2_1
and
subnetworkA: <xsl:value-of select="../../Subnetwork[@id='342__2_2_1']/@name"/>
is
M
but if I mixed the comands together it does not work:
subnetworkA: <xsl:value-of select="../../Subnetwork[@id='{../TopologicalEndPoints/TopologicalEndPointA/SubnetworkRef/@idref}']/@name"/>
Any ideas? Any other solution to the problem?
Help is really apreciated!!!
Thanks,
Monica
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list