extracting attribute value
XSLT novice request?
I am trying to extract an attribute value from a child element where the attribute values from its parent match an attribute value of a distant sibling. The value in the child element is a file path/name. The attributes in the other elements are identifiers. The end result needs to be an html file.
Here are the pertinent bits from the xml file:
<manifest identifier="CMD_0551402_M" version="1.0">
<organizations>
<organization identifier="CMD_0551403">
<item identifier="CMD_0551405">
<title>Lecture Notes</title>
<item identifier="CMD_0551406" identifierref="CMD_0551407">
<title>Lecture 1</title>
</item>
<item identifier="CMD_0551409" identifierref="CMD_0551410">
<title>Lecture 2</title>
</item>
</item>
</organization>
</organizations>
<resources>
<resource identifier="CMD_0551404">
<file href="properties_CMD_0551403.xml"/>
</resource>
<resource identifier="CMD_0551407">
<file href="lecture01.html"/>
</resource>
<resource identifier="CMD_0551410">
<file href="lecture2.html"/>
</resource>
</resources>
</manifest>
...and here's what I'm trying to do:
Find the value of organizations/organization/item/item/@identifierref
Find the value in resources/resource/@identifier that matches it
and plug the corresponding file/@href value into here:
<xsl:attribute name="href">
<xsl:value-of select="file/@href"/>
</xsl:attribute>
...with an end result in html of, for example:
<a href="lecture01.html">Lecture 1</a>
Any help much appreciated.
|