How to Parse XML in CDATA Sections with Saxon-B

XML

<?xml version="1.0" encoding="UTF-8"?>
<Root>
  <Element>Text</Element>
</Root>

XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="saxon" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/">
  <xsl:template match="/">
    <Root>
      <Element><xsl:value-of select="saxon:parse(/Root/Element)"/></Element> <!-- no need to use text() -->
    </Root>
  </xsl:template>
</xsl:stylesheet>

The extension is available here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s