XML add <a> hyperlink
-
03-07-2019 - |
Question
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
Solution
I'm guessing you aren't encoding the < and > characters correctly. You need to use < and >
OTHER TIPS
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</xsl:attribute>
Click here
</xsl:element>
renders
<a href="http://www.stackoverflow.com">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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow