How Add element to XML file?

How do I add a hyperlink in XML file?

  • I am doing a website and for the text, i have imported a xml file to display the text on the website. However I would like to be able to click on one of the text(extract from my xml file) as a hyperlink. Please help here! =)

  • Answer:

    If it is a problem with the way that XML is handling the "<a >" element, then you can try using a named entity such as "<" and ">" for the respective less-than and greater-than characters, or use their numeric equivalents (depending on the character-set chosen). If you are using a XSL, then you will need something similar to either of the following: <xsl:for-each select="urls/url"> <br/> <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> <xsl:template match="A"> <a> <xsl:attribute name="href"> <xsl:value-of select="@href"/> </xsl:attribute> <xsl:apply-templates /> </a> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> .

Dreyers at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

use &lt; and &gt; to escape the XML parsing.

Andy T

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.