Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Help with XSL templates
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

nomad_2k
Junior Member

United Kingdom
173 Posts

Posted - 25 May 2002 :  20:39:52  Show Profile
I know this forum is for asp but I haven't found an answer on any xml sites so her goes. I'm creating a content management system for my site, all the data is stored in a DB then converted to xml, merged with xsl and saved as a static html file. Now I want to use an xml tag for links like this:
<Link URL="http://somesite.com/">Some Text</Link>

the xsl template looks like this:
	<xsl:template match="Link">
<a href="{@URL}" target="_blank">
<xsl:value-of select="." />
</a>
</xsl:template>

And the question is how do I apply this template to the who xml file, so that it replaces all the <Link> tags?? I've only been able to get it to work by using <xsl:apply-template select="/Evolution/Gallery/Description/Link" /> and this replaces the first link tag and removes all the other text from arounf it.


Good things come to those who wait.
http://www.freeasphost.co.uk/evolution/

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 27 May 2002 :  05:24:29  Show Profile  Visit Kat's Homepage
You might want to try <xsl:copy-of select="."/> rather than xsl:value-of select="."/>.

copy-of takes the html as well as the text in between, value-of strips out the html and feed back the contents only.

KatsKorner

Installation Help | Snitz Mods | Forum Hosting
Go to Top of Page

mios
Junior Member

United Kingdom
101 Posts

Posted - 27 May 2002 :  09:27:25  Show Profile  Send mios an ICQ Message
This should do the trick, (obviously need to change the paths) but it should get you where you want.

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<div>
<xsl:for-each select="link">
<xsl:apply-templates select="link"/>
</xsl:for-each>
</div>
</xsl:template>

<xsl:template match="link">
<a>
<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:template>

</xsl:stylesheet>


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07