Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using HTML to present an XML document

Status
Not open for further replies.

Ciarak

Programmer
Oct 17, 2001
9
0
0
GB
I'm creating a webpage and I want all the file elements in my xml document to be links. My problem is how do I add strings together in html ( one is a html string and the other an xm).See code below(place marked **):

<xsl:for-each select=&quot;File&quot;>
<tr><td><a href=&quot;file:&quot; ** <xsl:value ofselect=&quot;@path&quot;/>>
<xsl:value-of select=&quot;@name&quot;/></td></tr></a>
 
when you are inside a tag the <xsl:value-of> can't be added. an XPath expression can be called tho (XPath is the bit that makes up the &quot;select&quot;) by opening some &quot;{}&quot;.

so <a href=&quot;file:{@path}&quot;><xsl:value-of select=&quot;@name&quot;/></a>
 
Hi Thanks for you help.The file names do appear as links on the web page but the file doesn't open when I click on them.The full path of each file is needed to open the file so is there a way of including the <xsl:value-of> inside the a href tag.
 
I'm not sure I if I'm getting the wrong end of the stick here but...
In the code below when you click on the NAME on the html page it takes you to the site specified in the SITE element of the XML file:

<xsl:for-each select=&quot;LINKS/ADDRESS/NEWS&quot; order-by=&quot;+NAME&quot;>
<li><font face=&quot;Arial&quot; size =&quot;2&quot; color=&quot;Navy&quot;><a target=&quot;_blank&quot;>
<xsl:attribute name=&quot;HREF&quot;>
<xsl:value-of select=&quot;SITE&quot;/>
</xsl:attribute><xsl:value-of select=&quot;NAME&quot;/>
</a></font></li>
</xsl:for-each>
</p>


XML file looks like:
<links>
<address>
<news>
<site> <name> a website</name>
</news>
</address>
</links>



Hope this is of some help.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top