[xsl] replacing special characters in xsl:copy

Subject: [xsl] replacing special characters in xsl:copy
From: "Dunning, John" <jdunning@xxxxxxx>
Date: Wed, 6 Jun 2007 12:37:30 -0400
Hello all,
I'm just beginning to get into XSLT 2.0 and I'm trying to copy the XML
source to an HTML report; what I would like to do is replace "<" and ">"
in the copied source with "&lt;" and "&gt;".

The soure looks similar to:

  <task location="L:\\build-log.xml:48: " name="foo" time="0 seconds">
    <message priority="warn"><![CDATA[ Text warning of foo ]]></message>

What I've got so far is this:

<xsl:output method="html" indent="yes"/>
  <xsl:template match="/">
	<xsl:for-each select="for $f in collection

('file:///c:/temp?select=*.xml;recurse=yes;on-error=ignore')  return
		  <xsl:when test="//message[@priority='warn']">
<h2>Warning in <xsl:value-of select="document-uri(.)"/>:</h2>
<h2>No errors or warnings in <xsl:value-of

What my desired output would be is:

<h2>Warning in file:/c:/temp/foo.xml </h2>
  &lt;task location="L:\\build-log.xml:48: " name="foo" time="0
    &lt;message priority="warn">&lt;![CDATA[ Text warning of foo

Is what I'm trying to do possible?  Am I on the right track?  Any
suggestions gratefully received.


Current Thread