code_junkie

XSLT Transformation Problem with disable output escaping

Nov 13th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <root>
  2. <node>
  3. <!--
  4. <a href="mailto:[email protected]"> Mail me </a>
  5. -->
  6. </node>
  7. </root>
  8.  
  9. <xsl:template match="/">
  10. <xsl:value-of select="/root/node/comment()" disable-output-escaping="yes"/>
  11. </xsl:template>
  12.  
  13. cristi:tmp diciu$ xsltproc test.xsl test.xml
  14. <?xml version="1.0"?>
  15.  
  16. <a href="mailto:[email protected]"> Mail me </a>
  17.  
  18. <xsl:template match="ahrefmail/comment()">
  19. <xsl:element name="a">
  20. <xsl:attribute name="href" select="../../mail"/>
  21. <xsl:attribute name="class" select="'text'"/>
  22. <xsl:text>Mail Me!</xsl:text>
  23. </xsl:element>
  24. </xsl:template>
  25.  
  26. <?xml version="1.0" ?>
  27. <root>
  28. <institution id="1">
  29. <data>
  30. <ahrefmail>
  31. <!--
  32. <a href='mailto:[email protected]' class='text'></a>
  33. -->
  34. </ahrefmail>
  35.  
  36. <mail>
  37. </mail>
  38. </data>
  39. </institution>
  40.  
  41.  
  42. <institution id="2">
  43. <data>
  44. <ahrefmail>
  45. <!--
  46. <a href='mailto:[email protected]' class='text'></a>
  47. -->
  48. </ahrefmail>
  49.  
  50. <mail>
  51. </mail>
  52. </data>
  53. </institution>
  54.  
  55. </root>
Add Comment
Please, Sign In to add comment