I am very new to xls and xml transformation so please excuse some ignorance. I have created a simplified example of my problem which the xmlCompiledTransform also has problems with. Below is the xml document and xsl document. The xmlcompiletransform does not return any html. The saxon transformation tool works as expected. I am not sure what to look for. Any help will be greatly appreciated.
sample xml:
Style sheet:
My vb.net code for the transforamtion:
sample xml:
HTML:
<?xml version="1.0" encoding="utf-8"?>
<n1:treasure xmlns:n1="myNamespace">
<piles>
<moreStuff>
<theStuff>gary</theStuff>
<theStuff>troy</theStuff>
</moreStuff>
<n1:otherStuff>
<junk>aaa</junk>
<junk>bbb</junk>
</n1:otherStuff>
</piles>
<misc>
<item1>item one</item1>
<item2>item two</item2>
</misc>
</n1:treasure>
Style sheet:
HTML:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n1="myNamespace">
<xsl:output method="html"/>
<xsl:strip-space elements="moreStuff thestuff n1:otherStuff junk"/>
<xsl:template match="n1:treasure">
<html>
<head>
<script language="javascript">
$(document).ready(function(){
var jnk = "<xsl:call-template name="getmoreStuff"/>";
var jnk1 = "<xsl:call-template name="getOtherStuff"/>";
});
</script>
</head>
<body>
<div id="here">Here I am</div>
</body>
</html>
</xsl:template>
<xsl:template name="getmoreStuff">
<xsl:if test="piles">
<xsl:copy-of select="piles/moreStuff"/>
</xsl:if>
</xsl:template>
<xsl:template name="getOtherStuff">
<xsl:copy-of select="piles/n1:otherStuff"/>
</xsl:template>
<xsl:template match="misc">
</xsl:template>
</xsl:stylesheet>
My vb.net code for the transforamtion:
Public Overrides Function Format(template As String, input As String) As String Try Dim transformer As New XslCompiledTransform(True) Dim templateDocument As New XmlDocument() templateDocument.LoadXml(template) transformer.Load(templateDocument) Dim xmlDoc As New XmlDocument xmlDoc.LoadXml(input) Using ts As New System.IO.StringWriter() transformer.Transform(xmlDoc, Nothing, ts) Return ts.ToString() End Using Catch ex As Exception EnRoute.Common.Logging.Manager.GetInstance.Log(New EnRoute.Common.Logging.LogEvent(ex.ToString(), Notification.EventTypes.Error, Notification.Severities.Medium, ex, "XSLTFormatter", "Format")) End Try Return String.Empty End Function
Last edited by a moderator: