1

I have an Xml transformation I need to do, but am having a bit of a struggle.

The input Xml looks like this...

<?xml version='1.0' encoding='utf-8' ?>
<content>
     <div>Stuff Goes Here</div>
</content>

And the stylesheet looks like this...

<?xml version='1.0' encoding='utf-8'?><xsl:stylesheet version='1.0'      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-microsoft-com:xslt'  exclude-result-prefixes='msxsl'>

<xsl:output method='html' />
     <xsl:template match='/'>
          <xsl:value-of select='content' disable-output-escaping='yes'   />
     </xsl:template>
</xsl:stylesheet>

I have got the transform working with c#, but it only returns "Stuff Goes Here" without the wrapping div tag.

2
  • What is your expected output? Is it be "<div>Stuff Goes Here</div>", as opposed to just "Stuff Goes Here"? Commented Aug 19, 2011 at 16:03
  • Yes, it should be <div>Stuff Goes Here</div> Commented Aug 19, 2011 at 16:10

1 Answer 1

3

Try this

<xsl:output method='html' />
<xsl:template match='/'>
    <xsl:copy-of select='content/div'/>
</xsl:template>
</xsl:stylesheet>

Outputs

<div>Stuff here</div>

Good Luck

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.