Transform XML via XSL and save as XML

  • 14 years ago

    Hi All,

    I'm attempting to save the xsl processors output back into XML, however when it gets to the save method it bombs out saying:

    Object required: 'xmlNewDoc'.

    Also I have dumped the contents of the output in the html and it works fine and the output I wanted is correct. For whatever reason it doesn't want to save. And its not a permissions settings as I have full rights.

    Code is as follows, if anyone can help I'd be most greatful!

    Set xslDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
    xslDoc.async = False
    xslDoc.setProperty "SelectionLanguage", "XPath"
    xslDoc.load( Server.MapPath("styles/xsl/rep_service_action.xsl") )

    Set xmlTemplate = Server.CreateObject("Msxml2.XSLTemplate.3.0")
    xmlTemplate.stylesheet = xslDoc

    Set myProc = xmlTemplate.createProcessor()
    myProc.input = xmlGroupDoc

    Set xmlNewDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
    xmlNewDoc.async = False
    xmlNewDoc.validateOnParse = False
    xmlNewDoc.preserveWhiteSpace = True
    xmlNewDoc.resolveExternals = False
    xmlNewDoc = myProc.output"C:\AMS_Final\MAINTENANCE\temp4.xml")

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="" version="1.0">
    <xsl:variable name="theStylesheet" select="document('')" />
    <xsl:output method="xml" version="4.0" encoding="utf-8"/>

    <xsl:template match="SERVICE_REQUESTS">
     <xsl:apply-templates select="REQUEST_LIST"/>

    <xsl:template match="REQUEST_LIST">
      <xsl:when test="count(row) > 0 ">
       <chart title='My Chart' legend='right'>
        <pie radius="1500" squash="1.5" thickness="20" labels="percent" />
         <title font="Georgia" size="20" color="#FF9900" bold="true" />
         <label font="Arial" size="12" color="#000000" bold="false" />
         <legend rowodd="#EEEEEE" even="#DDDDDD" border="#000000" />
        <values sort="descending">
         <node value="30" label="widget 1" color="#FF0000" />
         <node value="20" label="widget 2" color="#00FF00" />
         <node value="60" label="widget 3" color="#0000FF" />

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'” - Isaac Asimov