Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL Transform works in MSXML 4 but not in .NET

From: "Mike King" <emailMK@------.--->
To: NULL
Date: 1/6/2005 9:44:00 AM
I tried it with XmlSpy using an external program which uses the .NET 
XslTransform class and it worked fine.  If you provide a complete test case 
I might be able to offer more help.


"Buddy Ackerman" <buddy_nospam@b...> wrote in message 
news:OK9Vqr78EHA.3592@T......
>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.
>


--------------------------------------------------------------------------------


> <?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" />&#32;<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" />&#32;<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" />&#32;<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">&#32;</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">&#32;</td>
>                        </tr>
>                    </table>
>                    <table width="800" cellpadding="0" cellspacing="2" 
> style="background-color:#ffeb71">
>                        <tr>
>                            <td width="15">&#32;</td>
>                            <td class="menucell"><a class="smallGreyText" 
> href="registeruser.aspx">ECLECTIC A&amp;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">&#32;</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>


--------------------------------------------------------------------------------


> <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> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent