Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

slooksterPSV

macrumors 68040
Original poster
I'm going to post my code and then tell you what I want to do:
Code:
//EYEFILES.XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="eyefiles.xsl"?>
<!DOCTYPE EYEAPPS [
<!ELEMENT LINK (#PCDATA)>
<!ATTLIST LINK url CDATA #REQUIRED>
]>
<EYEAPPS>
	<APPS>
		<NAME>HTMLEdit</NAME>
		<AUTHOR>Shawn Barnes</AUTHOR>
		<LINK url="./downloads/HTMLEdit.eyeapp.zip"></LINK>
		<CATEGORY>Editors</CATEGORY>
	</APPS>
</EYEAPPS>
Code:
//EYEFILES.XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>EyeOS Applications</h2>
<h6><a href="http://www.eyeos.org">http://www.eyeos.org</a></h6>
<table border="1">
<tr bgcolor="#9acd32">
	<th align="left">Name</th>
	<th align="left">Author</th>
	<th align="left">Link</th>
	<th align="left">Category</th>
</tr>
<xsl:for-each select="EYEAPPS/APPS">
<tr>
	<td><xsl:value-of select="NAME"/></td>
	<td><xsl:value-of select="AUTHOR"/></td>
	<td>
<A><xsl:attribute name="TARGET">_BLANK</xsl:attribute>
<xsl:attribute name="HREF">
<xsl:value-of select="LINK.url"/>
</xsl:attribute>
DOWNLOAD
</A></td>
	<td><xsl:value-of select="CATEGORY"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
In the XML file (at the top) I've defined that LINK should have an attribute url. Now using XSL I want to be able to take whatever is in the variable url if it is defined like this <LINK url="http://www.somesite.com/somefile.extention"/> and use it to define a link in teh XSL as shown above. How would I do this?
I want to read the variable url that is nested in LINK using XSL(T). I don't want to have to try doing this through javascript or any other language if possible. I don't want to do the <LINK>URL</LINK> as would be easier. I would rather be able to define a variable inside the tag.
 
if I understand you correctly, you just want to extract an attribute value using a stylesheet.

The syntax is:
<xsl:value-of select="LINK/@url"/>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.