views:

1591

answers:

2

Hi,

I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperlink is a valid xml node?

thank you

+2  A: 

I'm guessing you aren't encoding the < and > characters correctly. You need to use &lt; and &gt;

Joel Coehoorn
<slaps forehead> awesome, thanks.
Paulj
No it's <slaps forehead>
Josh
+2  A: 

For more advanced html building, you may need to use the xsl:element tag:

  <xsl:element name="a">
    <xsl:attribute name="href">http://www.stackoverflow.com&lt;/xsl:attribute&gt;
    Click here
  </xsl:element>

renders

<a href="http://www.stackoverflow.com"&gt;Click here</a>

The nice thing about this is that the values for any of the "name" attributes or inner text can be computed xsl values.

James Curran