kpu8
asked on
**Error '80004005' The stylesheet does not contain a document element. **
I'm getting the following error using XML, XSl within an ASP page:
msxml3.dll error '80004005'
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.
Any help as to the fix to this would be great:
Here's my xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="/">
<!--calling the listitem, quote, manager, jobtitle, subhead, subsubhead, para-->
<xsl:apply-templates select="//listitem" mode="html"/>
<xsl:apply-templates select="//quote" mode="html"/>
<xsl:apply-templates select="//manager" mode="html"/>
<xsl:apply-templates select="//jobtitle" mode="html"/>
<xsl:apply-templates select="//subhead" mode="html"/>
<xsl:apply-templates select="//subsubhead" mode="html"/>
<xsl:apply-templates select="//para" mode="html"/>
</xsl:template>
<!--general template to facilitate proper xml element transformation-->
<xsl:template match="@* | node()" mode="html">
<xsl:copy><xsl:apply-templ ates select="@* | node()" mode="html"/></xsl:copy>
</xsl:template>
<!--general template for tables-->
<xsl:template match="table">
<TABLE>
<TR>
<xsl:for-each select="tgroup/colspec">
<TH>
<!--<xsl:value-of select="@colname"/>-->
</TH>
</xsl:for-each>
</TR>
<xsl:for-each select="tgroup/tbody/row">
<TR>
<xsl:for-each select="entry">
<TD>
<xsl:apply-templates/>
</TD>
</xsl:for-each>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="para">
<p>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates/>
</font>
</p>
</xsl:template>
<xsl:template match="listitem" mode="html">
<ul type="square">
<li>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
</font>
</li>
</ul>
</xsl:template>
<xsl:template match="emphasis" mode="html">
<xsl:variable name="style" select="@role"/>
<xsl:choose>
<xsl:when test="$style='bold'">
<b><xsl:apply-templates select="node()" mode="html" /></b>
</xsl:when>
<xsl:when test="$style='italic'">
<i><xsl:apply-templates select="node()" mode="html" /></i>
</xsl:when>
<xsl:when test="$style='bolditalic'" >
<b><i><xsl:apply-templates select="node()" mode="html" /></i></b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="node()" mode="html" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--to stop para from being outputted as an element-->
<xsl:template match="listitem/para" mode="html">
<xsl:apply-templates select="node()" mode="html" />
</xsl:template>
<xsl:template match="subhead" mode="html">
<B>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</B>
</xsl:template>
<xsl:template match="subsubhead" mode="html">
<B>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</B>
</xsl:template>
<xsl:template match="strategy" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="sup" mode="html">
<sup>
<xsl:value-of select="node()"/>
</sup>
</xsl:template>
<xsl:template match="sub" mode="html">
<sub>
<xsl:value-of select="node()"/>
</sub>
</xsl:template>
<xsl:template match="quote" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
<br/>
</font>
</xsl:template>
<xsl:template match="manager/para" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="jobtitle" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
</xsl:stylesheet>
Here's my xml:
<?xml version='1.0?>
<textsection><quote><para> "The document only says this is a test"</para></quote></ textsectio n>
I can also post the asp subroutine if that will help
Thanks
msxml3.dll error '80004005'
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.
Any help as to the fix to this would be great:
Here's my xsl:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="/">
<!--calling the listitem, quote, manager, jobtitle, subhead, subsubhead, para-->
<xsl:apply-templates select="//listitem" mode="html"/>
<xsl:apply-templates select="//quote" mode="html"/>
<xsl:apply-templates select="//manager" mode="html"/>
<xsl:apply-templates select="//jobtitle" mode="html"/>
<xsl:apply-templates select="//subhead" mode="html"/>
<xsl:apply-templates select="//subsubhead" mode="html"/>
<xsl:apply-templates select="//para" mode="html"/>
</xsl:template>
<!--general template to facilitate proper xml element transformation-->
<xsl:template match="@* | node()" mode="html">
<xsl:copy><xsl:apply-templ
</xsl:template>
<!--general template for tables-->
<xsl:template match="table">
<TABLE>
<TR>
<xsl:for-each select="tgroup/colspec">
<TH>
<!--<xsl:value-of select="@colname"/>-->
</TH>
</xsl:for-each>
</TR>
<xsl:for-each select="tgroup/tbody/row">
<TR>
<xsl:for-each select="entry">
<TD>
<xsl:apply-templates/>
</TD>
</xsl:for-each>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="para">
<p>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates/>
</font>
</p>
</xsl:template>
<xsl:template match="listitem" mode="html">
<ul type="square">
<li>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
</font>
</li>
</ul>
</xsl:template>
<xsl:template match="emphasis" mode="html">
<xsl:variable name="style" select="@role"/>
<xsl:choose>
<xsl:when test="$style='bold'">
<b><xsl:apply-templates select="node()" mode="html" /></b>
</xsl:when>
<xsl:when test="$style='italic'">
<i><xsl:apply-templates select="node()" mode="html" /></i>
</xsl:when>
<xsl:when test="$style='bolditalic'"
<b><i><xsl:apply-templates
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="node()" mode="html" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--to stop para from being outputted as an element-->
<xsl:template match="listitem/para" mode="html">
<xsl:apply-templates select="node()" mode="html" />
</xsl:template>
<xsl:template match="subhead" mode="html">
<B>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</B>
</xsl:template>
<xsl:template match="subsubhead" mode="html">
<B>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</B>
</xsl:template>
<xsl:template match="strategy" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="sup" mode="html">
<sup>
<xsl:value-of select="node()"/>
</sup>
</xsl:template>
<xsl:template match="sub" mode="html">
<sub>
<xsl:value-of select="node()"/>
</sub>
</xsl:template>
<xsl:template match="quote" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
<br/>
</font>
</xsl:template>
<xsl:template match="manager/para" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="jobtitle" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
</xsl:stylesheet>
Here's my xml:
<?xml version='1.0?>
<textsection><quote><para>
I can also post the asp subroutine if that will help
Thanks
ASKER
Note xml is (copying into these little boxes I always miss something):
<?xml version='1.0'?>
<textsection><quote><para> "The document only says this is a test"</para></quote>< /textsecti on>
<?xml version='1.0'?>
<textsection><quote><para>
ASKER
Note xml is (copying into these little boxes I always miss something):
<?xml version='1.0'?>
<textsection><quote><para> "The document only says this is a test"</para></quote>< /textsecti on>
<?xml version='1.0'?>
<textsection><quote><para>
ASKER
and it looks like I need to not hit re-fresh 3 times :)
XML Document
============
<?xml version="1.0" encoding="iso-8859-1"?>
<textsection>
<quote>
<para>"The document only says this is a test"</para>
</quote>
</textsection>
XSLT Document
=============
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="/">
<!--calling the listitem, quote, manager, jobtitle, subhead, subsubhead, para-->
<xsl:apply-templates select="//listitem" mode="html"/>
<xsl:apply-templates select="//quote" mode="html"/>
<xsl:apply-templates select="//manager" mode="html"/>
<xsl:apply-templates select="//jobtitle" mode="html"/>
<xsl:apply-templates select="//subhead" mode="html"/>
<xsl:apply-templates select="//subsubhead" mode="html"/>
<xsl:apply-templates select="//para" mode="html"/>
</xsl:template>
<!--general template to facilitate proper xml element transformation-->
<xsl:template match="@* | node()" mode="html">
<xsl:copy><xsl:apply-templ ates select="@* | node()" mode="html"/></xsl:copy>
</xsl:template>
<!--general template for tables-->
<xsl:template match="table">
<table>
<tr>
<xsl:for-each select="tgroup/colspec">
<th>
<!--<xsl:value-of select="@colname"/>-->
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="tgroup/tbody/row">
<tr>
<xsl:for-each select="entry">
<td>
<xsl:apply-templates/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="para">
<p>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates/>
</font>
</p>
</xsl:template>
<xsl:template match="listitem" mode="html">
<ul type="square">
<li>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
</font>
</li>
</ul>
</xsl:template>
<xsl:template match="emphasis" mode="html">
<xsl:variable name="style" select="@role"/>
<xsl:choose>
<xsl:when test="$style='bold'">
<b><xsl:apply-templates select="node()" mode="html" /></b>
</xsl:when>
<xsl:when test="$style='italic'">
<i><xsl:apply-templates select="node()" mode="html" /></i>
</xsl:when>
<xsl:when test="$style='bolditalic'" >
<b><i><xsl:apply-templates select="node()" mode="html" /></i></b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="node()" mode="html" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--to stop para from being outputted as an element-->
<xsl:template match="listitem/para" mode="html">
<xsl:apply-templates select="node()" mode="html" />
</xsl:template>
<xsl:template match="subhead" mode="html">
<b>
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</b>
</xsl:template>
<xsl:template match="subsubhead" mode="html">
<b>
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</b>
</xsl:template>
<xsl:template match="strategy" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</xsl:template>
<xsl:template match="sup" mode="html">
<sup><xsl:value-of select="node()"/></sup>
</xsl:template>
<xsl:template match="sub" mode="html">
<sub><xsl:value-of select="node()"/></sub>
</xsl:template>
<xsl:template match="quote" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
<br/>
</font>
</xsl:template>
<xsl:template match="manager/para" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="jobtitle" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
</xsl:stylesheet>
HTML Output
===========
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<para>"The document only says this is a test"</para>
<br>
</font>
<para>"The document only says this is a test"</para>
============
<?xml version="1.0" encoding="iso-8859-1"?>
<textsection>
<quote>
<para>"The document only says this is a test"</para>
</quote>
</textsection>
XSLT Document
=============
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="/">
<!--calling the listitem, quote, manager, jobtitle, subhead, subsubhead, para-->
<xsl:apply-templates select="//listitem" mode="html"/>
<xsl:apply-templates select="//quote" mode="html"/>
<xsl:apply-templates select="//manager" mode="html"/>
<xsl:apply-templates select="//jobtitle" mode="html"/>
<xsl:apply-templates select="//subhead" mode="html"/>
<xsl:apply-templates select="//subsubhead" mode="html"/>
<xsl:apply-templates select="//para" mode="html"/>
</xsl:template>
<!--general template to facilitate proper xml element transformation-->
<xsl:template match="@* | node()" mode="html">
<xsl:copy><xsl:apply-templ
</xsl:template>
<!--general template for tables-->
<xsl:template match="table">
<table>
<tr>
<xsl:for-each select="tgroup/colspec">
<th>
<!--<xsl:value-of select="@colname"/>-->
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="tgroup/tbody/row">
<tr>
<xsl:for-each select="entry">
<td>
<xsl:apply-templates/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="para">
<p>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates/>
</font>
</p>
</xsl:template>
<xsl:template match="listitem" mode="html">
<ul type="square">
<li>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
</font>
</li>
</ul>
</xsl:template>
<xsl:template match="emphasis" mode="html">
<xsl:variable name="style" select="@role"/>
<xsl:choose>
<xsl:when test="$style='bold'">
<b><xsl:apply-templates select="node()" mode="html" /></b>
</xsl:when>
<xsl:when test="$style='italic'">
<i><xsl:apply-templates select="node()" mode="html" /></i>
</xsl:when>
<xsl:when test="$style='bolditalic'"
<b><i><xsl:apply-templates
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="node()" mode="html" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--to stop para from being outputted as an element-->
<xsl:template match="listitem/para" mode="html">
<xsl:apply-templates select="node()" mode="html" />
</xsl:template>
<xsl:template match="subhead" mode="html">
<b>
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</b>
</xsl:template>
<xsl:template match="subsubhead" mode="html">
<b>
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</b>
</xsl:template>
<xsl:template match="strategy" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2"><xsl:value-of select="node()"/></font>
</xsl:template>
<xsl:template match="sup" mode="html">
<sup><xsl:value-of select="node()"/></sup>
</xsl:template>
<xsl:template match="sub" mode="html">
<sub><xsl:value-of select="node()"/></sub>
</xsl:template>
<xsl:template match="quote" mode="html">
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:apply-templates select="node()" mode="html" />
<br/>
</font>
</xsl:template>
<xsl:template match="manager/para" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
<xsl:template match="jobtitle" mode="html">
<br/>
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<xsl:value-of select="node()"/>
</font>
</xsl:template>
</xsl:stylesheet>
HTML Output
===========
<font face="Arial, MS Sans Serif, Helvetica" size="2">
<para>"The document only says this is a test"</para>
<br>
</font>
<para>"The document only says this is a test"</para>
Notes
=====
1. The problem is that on the client-side, it is loading the resulting output from the transformation as an XML Document.
2. By default the mime type used by ASP is "text/html". You have a directive:
Response.ContentType = "text/xml"
Change That to:
Response.ContentType = "text/html" OR comment out the directive that is causing to be mistaken as XML Output.
Since the HTML output as shown above has two nodes at the root level, the data is invalid as an XML Document
3. Although it appears that you are doing this as a test, you might have totally misunderstood the element transformation technique.
=====
1. The problem is that on the client-side, it is loading the resulting output from the transformation as an XML Document.
2. By default the mime type used by ASP is "text/html". You have a directive:
Response.ContentType = "text/xml"
Change That to:
Response.ContentType = "text/html" OR comment out the directive that is causing to be mistaken as XML Output.
Since the HTML output as shown above has two nodes at the root level, the data is invalid as an XML Document
3. Although it appears that you are doing this as a test, you might have totally misunderstood the element transformation technique.
ASKER
Putting the contenttype to text/html gave me the same error - I'll fill in some more pieces - here's my call to a subroutine which is on my main ASP page - the subroutine is in a include file and is the only routine in that file:
<%fundmgmtpersp(rsPersp.Fi elds("XML_ DATA").Val ue)%>
Here is the subroutine:
<%
sub fundmgmtpersp(xml_data)
Dim xmlDoc, xslDoc
Set xmlDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
Set xslDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
xmlDoc.loadXML (("<text>") & xml_data & ("</text>"))
xslDoc.load (Server.MapPath("testpub.x sl"))
Response.Write xmlDoc.TransformNode(xslDo c)
set xmlDoc = Nothing
set xslDoc = Nothing
end sub
%>
<%fundmgmtpersp(rsPersp.Fi
Here is the subroutine:
<%
sub fundmgmtpersp(xml_data)
Dim xmlDoc, xslDoc
Set xmlDoc = Server.CreateObject("MSXML
Set xslDoc = Server.CreateObject("MSXML
xmlDoc.loadXML (("<text>") & xml_data & ("</text>"))
xslDoc.load (Server.MapPath("testpub.x
Response.Write xmlDoc.TransformNode(xslDo
set xmlDoc = Nothing
set xslDoc = Nothing
end sub
%>
ASKER
Also, please be advised that I'm pulling this data from the db so each chunk of data doesn't have the standard xml version = 1.0 at the top it starts at <textsection>
I merely plugged that in since I thought the problem was with the xsl:
Now if I have this piece of code all in one file - I get the correct Transformation using Response.Write xmlDoc.TransformNode(xslDo c):
<%@LANGUAGE = VBSCRIPT%>
<!--#include virtual="/ffw/share/adovbs .inc"-->
<%
Dim p1(2), dbObj, rsPersp
Dim xmlDoc, xslDoc
' Database object
Set dbObj = Server.CreateObject("comob ject.isher e")
' p1: Parameters for XML_QUERY_TEXT query
' 0: fmp string
' 1: Basket ID
fmp = "the data"
set p1(0) = Server.CreateObject ("ADODB.Parameter")
p1(0).Value = CStr(fmp)
p1(0).Type = adBStr
id = "91"
set p1(1) = Server.CreateObject ("ADODB.Parameter")
p1(1).Value = id
p1(1).Type = adInteger
Set rsPersp = dbObj.GetRecordSet("XML_QU ERY_TEXT", p1)
Set xmlDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
Set xslDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
xmlDoc.loadXML (("<text>") & (rsPersp.Fields("XML_DATA" ).Value) & ("</text>"))
xslDoc.Load (Server.MapPath("testpub.x sl"))
Response.Write xmlDoc.TransformNode(xslDo c)
set p1(0) = nothing
set p1(1) = nothing
Set xmlDoc = Nothing
Set xslDoc = Nothing
%>
I merely plugged that in since I thought the problem was with the xsl:
Now if I have this piece of code all in one file - I get the correct Transformation using Response.Write xmlDoc.TransformNode(xslDo
<%@LANGUAGE = VBSCRIPT%>
<!--#include virtual="/ffw/share/adovbs
<%
Dim p1(2), dbObj, rsPersp
Dim xmlDoc, xslDoc
' Database object
Set dbObj = Server.CreateObject("comob
' p1: Parameters for XML_QUERY_TEXT query
' 0: fmp string
' 1: Basket ID
fmp = "the data"
set p1(0) = Server.CreateObject ("ADODB.Parameter")
p1(0).Value = CStr(fmp)
p1(0).Type = adBStr
id = "91"
set p1(1) = Server.CreateObject ("ADODB.Parameter")
p1(1).Value = id
p1(1).Type = adInteger
Set rsPersp = dbObj.GetRecordSet("XML_QU
Set xmlDoc = Server.CreateObject("MSXML
Set xslDoc = Server.CreateObject("MSXML
xmlDoc.loadXML (("<text>") & (rsPersp.Fields("XML_DATA"
xslDoc.Load (Server.MapPath("testpub.x
Response.Write xmlDoc.TransformNode(xslDo
set p1(0) = nothing
set p1(1) = nothing
Set xmlDoc = Nothing
Set xslDoc = Nothing
%>
ASKER
Also, please be advised that I'm pulling this data from the db so each chunk of data doesn't have the standard xml version = 1.0 at the top it starts at <textsection>
I merely plugged that in since I thought the problem was with the xsl:
Now if I have this piece of code all in one file - I get the correct Transformation using Response.Write xmlDoc.TransformNode(xslDo c):
<%@LANGUAGE = VBSCRIPT%>
<!--#include virtual="/ffw/share/adovbs .inc"-->
<%
Dim p1(2), dbObj, rsPersp
Dim xmlDoc, xslDoc
' Database object
Set dbObj = Server.CreateObject("comob ject.isher e")
' p1: Parameters for XML_QUERY_TEXT query
' 0: fmp string
' 1: Basket ID
fmp = "the data"
set p1(0) = Server.CreateObject ("ADODB.Parameter")
p1(0).Value = CStr(fmp)
p1(0).Type = adBStr
id = "91"
set p1(1) = Server.CreateObject ("ADODB.Parameter")
p1(1).Value = id
p1(1).Type = adInteger
Set rsPersp = dbObj.GetRecordSet("XML_QU ERY_TEXT", p1)
Set xmlDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
Set xslDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
xmlDoc.loadXML (("<text>") & (rsPersp.Fields("XML_DATA" ).Value) & ("</text>"))
xslDoc.Load (Server.MapPath("testpub.x sl"))
Response.Write xmlDoc.TransformNode(xslDo c)
set p1(0) = nothing
set p1(1) = nothing
Set xmlDoc = Nothing
Set xslDoc = Nothing
%>
I merely plugged that in since I thought the problem was with the xsl:
Now if I have this piece of code all in one file - I get the correct Transformation using Response.Write xmlDoc.TransformNode(xslDo
<%@LANGUAGE = VBSCRIPT%>
<!--#include virtual="/ffw/share/adovbs
<%
Dim p1(2), dbObj, rsPersp
Dim xmlDoc, xslDoc
' Database object
Set dbObj = Server.CreateObject("comob
' p1: Parameters for XML_QUERY_TEXT query
' 0: fmp string
' 1: Basket ID
fmp = "the data"
set p1(0) = Server.CreateObject ("ADODB.Parameter")
p1(0).Value = CStr(fmp)
p1(0).Type = adBStr
id = "91"
set p1(1) = Server.CreateObject ("ADODB.Parameter")
p1(1).Value = id
p1(1).Type = adInteger
Set rsPersp = dbObj.GetRecordSet("XML_QU
Set xmlDoc = Server.CreateObject("MSXML
Set xslDoc = Server.CreateObject("MSXML
xmlDoc.loadXML (("<text>") & (rsPersp.Fields("XML_DATA"
xslDoc.Load (Server.MapPath("testpub.x
Response.Write xmlDoc.TransformNode(xslDo
set p1(0) = nothing
set p1(1) = nothing
Set xmlDoc = Nothing
Set xslDoc = Nothing
%>
Implement the following:
========================
<%fundmgmtpersp(rsPersp.Fi elds("XML_ DATA").Val ue)%>
<%
Sub fundmgmtpersp(xml_data)
Dim xmlDoc, xslDoc
Set xmlDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
Set xslDoc = Server.CreateObject("MSXML 2.DOMDocum ent")
'synchronous loading when loading from web server
xmlDoc.async = False : xslDoc.async = False
xmlDoc.loadXML "<text>" & xml_data & "</text>"
xslDoc.load Server.MapPath("testpub.xs l")
If xmlDoc.parseError.errorCod e = 0 And xslDoc.parseError.errorCod e = 0 Then
Response.Write xmlDoc.TransformNode(xslDo c)
Else
'single line
If xmlDoc.parseError.errorCod e <> 0 Then errorinLoading("Error In Loading XML Tree",xmlDoc.parseError)
'single line
If xslDoc.parseError.errorCod e <> 0 Then errorinLoading("Error In Loading XSLT Tree",xslDoc.parseError)
End If
Set xmlDoc = Nothing
Set xslDoc = Nothing
End Sub
'xml error handling routine
Sub errorInLoading(ByVal szMsg, ByRef oParse)
Response.Write "<div>" & szMsg & "</div>"
Response.Write "<div>Error Number: " & oParse.errorCode & "</div>"
Response.Write "<div>Reason: " & oParse.reason & "</div>"
Response.Write "<div>Line: " & oParse.line & "</div>"
Response.Write "<div>LinePos: " & oParse.linepos & "</div>"
Response.Write "<div>FilePos: " & oParse.filepos & "</div>"
End Sub
%>
========================
<%fundmgmtpersp(rsPersp.Fi
<%
Sub fundmgmtpersp(xml_data)
Dim xmlDoc, xslDoc
Set xmlDoc = Server.CreateObject("MSXML
Set xslDoc = Server.CreateObject("MSXML
'synchronous loading when loading from web server
xmlDoc.async = False : xslDoc.async = False
xmlDoc.loadXML "<text>" & xml_data & "</text>"
xslDoc.load Server.MapPath("testpub.xs
If xmlDoc.parseError.errorCod
Response.Write xmlDoc.TransformNode(xslDo
Else
'single line
If xmlDoc.parseError.errorCod
'single line
If xslDoc.parseError.errorCod
End If
Set xmlDoc = Nothing
Set xslDoc = Nothing
End Sub
'xml error handling routine
Sub errorInLoading(ByVal szMsg, ByRef oParse)
Response.Write "<div>" & szMsg & "</div>"
Response.Write "<div>Error Number: " & oParse.errorCode & "</div>"
Response.Write "<div>Reason: " & oParse.reason & "</div>"
Response.Write "<div>Line: " & oParse.line & "</div>"
Response.Write "<div>LinePos: " & oParse.linepos & "</div>"
Response.Write "<div>FilePos: " & oParse.filepos & "</div>"
End Sub
%>
ASKER
Ok thanks - that get's me a step further the error I get is:
Error In Loading XSLT Tree
Error Number: -2146697210
Reason: The system cannot locate the object specified.
Line: 0
LinePos: 0
FilePos: 0
Also just an FYI since we were using subs I changed these lines:
If xmlDoc.parseError.errorCod e <> 0 Then errorinLoading("Error In Loading XML Tree",xmlDoc.parseError)
'single line
If xslDoc.parseError.errorCod e <> 0 Then errorinLoading("Error In Loading XSLT Tree",xslDoc.parseError)
to just:
If xmlDoc.parseError.errorCod e <> 0 Then errorinLoading "Error In Loading XML Tree",xmlDoc.parseError
'single line
If xslDoc.parseError.errorCod e <> 0 Then errorinLoading"Error In Loading XSLT Tree",xslDoc.parseError
Since ASP said I could have parens when calling a sub
which I could've sworn I've done before?
Error In Loading XSLT Tree
Error Number: -2146697210
Reason: The system cannot locate the object specified.
Line: 0
LinePos: 0
FilePos: 0
Also just an FYI since we were using subs I changed these lines:
If xmlDoc.parseError.errorCod
'single line
If xslDoc.parseError.errorCod
to just:
If xmlDoc.parseError.errorCod
'single line
If xslDoc.parseError.errorCod
Since ASP said I could have parens when calling a sub
which I could've sworn I've done before?
Find out what this resolves to.
Server.MapPath("testpub.xs l").
If it is the wrong path, and your app allows for parent paths (by default) then, for e.g. Server.MapPath("../xslt/te stpub.xsl" )
Server.MapPath("testpub.xs
If it is the wrong path, and your app allows for parent paths (by default) then, for e.g. Server.MapPath("../xslt/te
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for all your help - it was a fix to
Server.MapPath("/xslt/test pub.xsl")
jeez I didn't see that - it's always the little things isn't it - kind of like when I use to program in C and C++ and got bit by { a zillion times
At any case thanks - this gives me a great working beta which will go to a live site soon utilizing xml
Server.MapPath("/xslt/test
jeez I didn't see that - it's always the little things isn't it - kind of like when I use to program in C and C++ and got bit by { a zillion times
At any case thanks - this gives me a great working beta which will go to a live site soon utilizing xml
it always is the little things that complicates matters unfortunately... Glad to be of help =)
ASKER
<?xml version='1.0'?>
<textsection><quote><para>