Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XSL Transform works in MSXML 4 but not in .NET XSL Transform works in MSXML 4 but not in .NETTo: NULL Date: 1/6/2005 12:43:00 AM This is a multi-part message in MIME format.
--------------020408030403000301080904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I have a transform (a quite simple one) that transforms properly using MSXML4 (I use MarrowSfot's Xselerator to test it)
but not when I transform the document through .NET (framework version 1.1). I've attached sample XML and XSL that work
in Xselerator but not in .NET.
The part that is not working (in .NET anyway) is the blog text. Near the bottom of the XML document there is a div
element with id="blog". The second row of the table in the div element should be displaying the text from the blogtext
element in the xml document. Works fine when I test it in Xselerator (using the MSXML4 engine) but that cell is empty
when I transform it using the .NET transform engine.
Here's the function I wrote in .NET to do transforms:
Public Function xFormDoc(xdoc As XmlDocument, _
xslDocPath As String, _
xslArgs As XsltArgumentList) As String
Dim s As New stringwriter()
Dim xslt as XslTransform = new XslTransform()
Try
xslt.Load(xslDocPath)
xslt.Transform(xdoc, xslArgs, s, nothing)
Catch e As Exception
xFormDoc = e.Message
Exit Function
End Try
xFormDoc = s.ToString()
End Function
Makes me want to pull my hair out.
--------------020408030403000301080904
Content-Type: text/xml;
name="xslDoc.xsl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="xslDoc.xsl"
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" standalone="yes" omit-xml-declaration="yes" encoding="utf-8" indent="yes" />
<xsl:template match="welcome">
<html>
<body bgcolor="black">
<div id="pagecontainer" style="position:absolute">
<img src="IndieBG.jpg" border="0" />
<span id="" style="position:absolute;top:52px;left:400px"><img src="circles.gif" border="0" /> <a class="smallGreyText" href="registeruser.aspx">CREATE MY ACCOUNT</a></span>
<span id="" style="position:absolute;top:52px;left:563px"><img src="circles.gif" border="0" /> <a class="smallGreyText" href="registeruser.aspx">MY ARTISTS</a></span>
<span id="" style="position:absolute;top:52px;left:670px"><img src="circles.gif" border="0" /> <a class="smallGreyText" href="registeruser.aspx">MY DOWNLOADS</a></span>
<div id="menu" style="position:absolute;top:85px;left:0px;width:100%;padding">
<table width="800" cellpadding="0" cellspacing="2" style="background-color:#bbb338">
<tr>
<td width="15"> </td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">HOW THIS WORKS</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">HOW TO DOWNLOAD</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">A-Z: SEARCH BY GENRE</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">OUR PLAYLIST</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">ECLECTIC CHATTER</a></td>
<td class="menucell" style="border-right:none"><a class="smallGreyText" href="registeruser.aspx">TV SPOTS</a></td>
<td width="15"> </td>
</tr>
</table>
<table width="800" cellpadding="0" cellspacing="2" style="background-color:#ffeb71">
<tr>
<td width="15"> </td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">ECLECTIC A&R</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">REGIONAL: INTERNATIONAL</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">ARTISTIC DIRECTORS</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">INDIECLECTIC ANGELS</a></td>
<td class="menucell"><a class="smallGreyText" href="registeruser.aspx">OUR DE-CRAPPER</a></td>
<td class="menucell" style="border-right:none"><a class="smallGreyText" href="registeruser.aspx">LINKS</a></td>
<td width="15"> </td>
</tr>
</table>
</div>
<div id="topad" style="position:absolute;top:135px;left:215px;height:55px;width:500px;background-color:black;color:white;">SOME ADVERTISEMENT</div>
<div id="rightad" style="position:absolute;top:200px;left:675px;height:399px;width:124px;background-color:black;color:white;overflow:auto;">ANOTHER <br/> AD</div>
<div id="mission" style="position:absolute;top:135px;left:25px;height:200px;width:180px;border:1px solid black;overflow:auto;">
<table cellspacing="0" width="100%"><tr><td bgcolor="#666666" height="30" width="80%" style="color:white;font-family:verdana;font-size:8pt;font-weight:bold;">mission statement</td><td></td></tr><tr><td colspan="2"></td></tr></table>
</div>
<div id="news" style="position:absolute;top:345px;left:25px;height:250px;width:180px;border:1px solid black;overflow:auto;">
<table cellspacing="0" width="100%">
<tr><td bgcolor="#666666" height="30" width="80%" style="color:white;font-family:verdana;font-size:8pt;font-weight:bold;">indie news</td><td></td></tr>
<tr><td colspan="2"><xsl:value-of select="news" /></td></tr>
</table>
</div>
<div id="blog" style="position:absolute;top:200px;left:215px;height:55px;width:445px;border:1px solid black;overflow:auto;">
<table cellspacing="0" width="100%">
<tr><td bgcolor="#666666" height="30" width="15%" style="color:white;font-family:verdana;font-size:8pt;font-weight:bold;">blog</td><td></td></tr>
<tr><td colspan="2"><xsl:value-of select="blog/blogtext" disable-output-escaping="yes" /></td></tr>
</table>
</div>
<div id="founders" style="position:absolute;top:265px;left:215px;height:320px;width:445px;border:1px solid black;overflow:auto;">
<table cellspacing="0" width="100%">
<tr><td bgcolor="#666666" height="30" width="40%" style="color:white;font-family:verdana;font-size:8pt;font-weight:bold;">founding artists</td><td></td></tr>
<tr><td colspan="2"></td></tr>
</table>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--------------020408030403000301080904
Content-Type: text/xml;
name="xDoc.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="xDoc.xml"
<welcome>
<news>This is news text for the site. Testing</news>
<cartoon />
<blog id="1">
<blogDt>01-05-2005 10:28PM</blogDt>
<title><![CDATA[ Blog Title
]]></title>
<blogtext><![CDATA[ The site blog text
]]></blogtext>
</blog>
</welcome>
--------------020408030403000301080904--
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
