开发者

Xml transform with HTML in the source only returns text

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='开发者_JAVA百科/'>
          <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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜