1. Your XML isn't well formed.
2. To accurately decode escaped HTML, you would need an extension
function or you could do it using a template that searches for and
replaces all occurrences of the required entities.
2. Instead of trying to include HTML within XML, I would rather let it
contain what it is designed for - storage of data. To elaborate, my
XML would rather be :

---
<?xml version="1.0"?>
<NewDataSet>
  <Table>
    <link>http://cas.sdss.org/dr7/en/tools/chart/navi.asp?
ra=166.358&amp;dec=-0.748596</link>
 <img>http://casjobs.sdss.org/ImgCutoutDR7/getjpeg.aspx?
ra=166.358&amp;dec=-0.748596&amp;scale=0.40&amp;width=120&amp;height=120&amp;opt=</
img>
    <name>J1105</name>
    <ra>16.25829</ra>
    <dec>-7.74849605</dec>
    <mag_g>18.9</mag_g>
    <id>587722982270959696</id>
    <sep>0.02</sep>
  </Table>
</NewDataSet>
---

And I would use the following XSLT to get an accurate result :

---
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/
>

<xsl:template match="/">
  <html>
  <body>
  <h2>Lots of Junk</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">pic</th>
        <th align="left">name</th>
     </tr>
      <xsl:for-each select="NewDataSet/Table">
      <tr>
        <td>
          <xsl:element name="a">
            <xsl:attribute name="href">
              <xsl:value-of select="link" />
            </xsl:attribute>
            <xsl:element name="img">
              <xsl:attribute name="src">
                <xsl:value-of select="img" />
              </xsl:attribute>
            </xsl:element>
          </xsl:element>
        </td>
        <td><xsl:value-of select="name" /></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
---

This way, I do not need to bother about escaping HTML tags because
they are not present in the XML. The XML only stores the data which
will become the attributes of a tag.

On Nov 20, 10:14 pm, Eoj <[EMAIL PROTECTED]> wrote:
> Hello, new to xml markup, have a question. Need to display a hyperlink
> in a marked up xml file, here is an excerpt. . .
> ================================================================================
> <NewDataSet>
>
>       <Table>
>         <pic>&lt;a href=http://cas.sdss.org/dr7/en/tools/chart/
> navi.asp?ra=166.358&amp;dec=-0.748596&gt;
>                 &lt;img 
> src="http://casjobs.sdss.org/ImgCutoutDR7/getjpeg.aspx?
> ra=166.358&amp;dec=-0.748596&amp;scale=0.40&amp;width=120&amp;height=120&amp;opt="/
> &gt; </pic>
>
>         <name>J1105<name>
>
>         <ra>16.25829</ra>
>
>         <dec>-7.74849605</dec>
>
>         <mag_g>18.9</mag_g>
>
>         <id>587722982270959696</id>
>
>         <sep>0.02</sep>
>
>  /Table>
>
> </NewDataSet>
> =======================================================
>
> and the xsl is below. The table as displayed in html only has the long
> link that is not clickable. How does one make a clickable hyperlink
> from an xml database?
>
> ==================================================
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/
>
>
>
> <xsl:template match="/">
>   <html>
>   <body>
>   <h2>Lots of Junk</h2>
>     <table border="1">
>       <tr bgcolor="#9acd32">
>         <th align="left">pic</th>
>         <th align="left">name</th>
>      </tr>
>       <xsl:for-each select="NewDataSet/Table">
>       <tr>
>         <td><xsl:value-of select="pic"/></td>
>         <td><xsl:value-of select="name"/></td>
>       </tr>
>       </xsl:for-each>
>     </table>
>   </body>
>   </html>
> </xsl:template>
> </xsl:stylesheet>

Reply via email to