Subject: Re: How to create active hyperlinks from xml file From: Jeni Tennison <Jeni.Tennison@xxxxxxxxxxxxxxxx> Date: Tue, 18 Jul 2000 10:17:07 +0100 |
Joe, ><!--this is where I cannot get this to work. I get "joe" on my webpage but >it is not a hyperlink > <td align="center" class="ind"> > <xsl:value-of select="xlink:simple"/> > </td> >//--> > <td align="center" class="ind"> > <a href="index.xml"><xsl:value-of select="webadd"/></a> > <a href="http://www.joeinternet.net"><xsl:value-of >select="webadd1"/></a> > </td> Looking at the HTML that's produced by this piece of XSLT identifies the problem. At least in SAXON, for the first company (E-Z Credit Motors) you get: <td align="center" class="ind"> <a href="index.xml">click here</a> <a href="http://www.joeinternet.net"></a> </td> If you look at the input that you're using for that company: <company> <name>E-Z Credit Motors</name> <address> 19465 Sumpter Rd. Belleville, MI 48111 </address> <phone>(734) 697-2682</phone> <xlink:simple xmlns:xlink="http://www.w3.org/XML/XLink/0.9" href="mailto:joe@xxxxxxxxxxxxxxx"> <email>joe</email> </xlink:simple> <webadd>click here</webadd> </company> You can see that the 'click here' text from within the 'webadd' element is inserted correctly within the <a href="index.xml">...</a>. This is because the XPath used in the 'select' attribute of the xsl:value-of element specifies that the value of the 'webadd' child of the current node (which is the 'company' element) should be inserted between those tags. Within the next link, however, the XSLT processor (an old version of MSXML to judge by your xsl namespace) tries to insert the value of the 'webadd1' child of the current node (again, the 'company' element) to create the text within the <a href="http://www.joeinternet.net">...</a> element. Your input for this particular company doesn't have a 'webadd1' element, so no text is put within the link, so it *appears* that the link isn't there at all. If you look at the second company (Gib's Auto Sales), then there appears to be a link to http://www.joeinternet.net, but none to index.xml - there, you have a 'webadd1' element, but no 'webadd' element. The solution, then, should be something like: <td align="center" class="ind"> <a href="index.xml"><xsl:value-of select="webadd" /></a> <!-- href is the value of the href attribute of the xlink:simple element that is a child of the current company --> <a href="{xlink:simple/@href}"> <!-- text is the value of the email child of the xlink:simple element that is a child of the current company --> <xsl:value-of select="xlink:simple/email" /> </a> </td> A couple of points about the versions of the XML-related standards that you're using. The XSLT 1.0 Recommendation was issued in November 1999, and you should really be using it instead of the old version. The new namespace is "http://www.w3.org/1999/XSL/Transform", and MSXML (and hence IE5) will support it if you get the latest version from the Microsoft MSDN website and install it properly. The Candidate Recommendation of XLink was issued on 3rd July and has a different namespace ("http://www.w3.org/1999/xlink") and a somewhat different way of defining links to the one you're using. You should *probably* change your input to look something like: <email xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="mailto:joe@xxxxxxxxxxxxxxx"> joe </email> but I recommend reading the new version of the XLink spec to see what it offers. I hope that helps, Jeni Dr Jeni Tennison Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE Telephone 0115 9061301 ? Fax 0115 9061304 ? Email jeni.tennison@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: How to create active hyperlinks, Joe McDonald | Thread | RE: How to create active hyperlinks, Charles Cantrell |
Re: Simplified production for Filte, Paul Tchistopolskii | Date | Re: Simplified production for Filte, David Carlisle |
Month |