XSL link codes

Discussion in 'Programming' started by lithman, Jan 18, 2008.

  1. #1
    I'm working on my companies website and trying to add a section to it. It's done in XML and I'm not too familiar with it. This is the current line of code I have


    <span class="titles">Official Website:</span><xsl:text> </xsl:text><xsl:value-of select="officialWebsite" /><br/>	
    	<img src="../images/cleargif.gif" alt="spacer" width="1" height="20" border="0" />
    Code (markup):
    Now, I'm trying to add a section for Official Websites, but the xsl:text command won't let me put links in it. on the call page I tried adding an

    <a href="http://www.website.com">
    Code (markup):
    but it didn't make it a link, it just kept it as text.

    I guess I'm trying to change the <xsl:text> code to like <xsl:link> so it will let me put a link in there.

    I checked this page, but didn't see any of the elements that will make it a link.
    http://www.w3schools.com/xsl/xsl_w3celementref.asp
     
    lithman, Jan 18, 2008 IP
  2. lithman

    lithman Well-Known Member

    Messages:
    1,189
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #2
    I found the answer.

    XSL document:

    xsl:for-each select="urls/url">
    <xsl:text> </xsl:text>
    <xsl:element name="a">
    <xsl:attribute name="href">
    <xsl:value-of select="@address" />
    </xsl:attribute>
    <xsl:value-of select="@desc" />
    </xsl:element>
    </xsl:for-each>


    XML Document:

    <urls>
    <url desc="description" address="www.mydomain.com" />
    </urls>
     
    lithman, Jan 18, 2008 IP