This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Problem with XMLDOM and xsl:template macth
- To: XSL-List at mulberrytech dot com
- Subject: Problem with XMLDOM and xsl:template macth
- From: "Gavin Landon" <gavin at karland dot com>
- Date: Wed, 10 May 2000 12:25:55 -0500
- References: <200005101704.NAA20001@mulberrytech.com>
- Reply-To: xsl-list at mulberrytech dot com
This may be lengthy, but I need you to understand exactly what I'm doing so if there is a better way please let me know...
I have posted on many NewsGroups and everyone has a different way to do it and none seem to work for me. The XMLDOM object fails on "strResults = objXMLDoc.transformNode(objXSLDoc)
", for each of the examples given to me.
I'm using this function on the ServerSide if IIS to create my HTML page:
( domain1.asp returns XML and domain2.asp returns XSL )
++++++++++++++++++++++++++++++++++++++++++++++++
sXML = TransformXML("http://www.domain1.com/domain1.asp", "http://www.domain2.com/doamain2.asp")
function TransformXML(strXMLDoc, strXSLDoc)
'on error resume next
dim objXMLDoc
dim objXSLDoc
dim strResults
' PROG_ID = "Microsoft.XMLDOM"
PROG_ID = "Microsoft.FreeThreadedXMLDOM"
if err.number = 0 then
'Parse the XML Document
set objXMLDoc = server.CreateObject(PROG_ID)
objXMLDoc.async = false
objXMLDoc.load(strXMLDoc)
if objXMLDoc.parseError.errorCode = 0 then
'Parse the XSL stylesheet
set objXSLDoc = server.CreateObject(PROG_ID)
objXSLDoc.async = false
objXSLDoc.load(strXSLDoc)
if objXSLDoc.parseError.errorCode = 0 then
'If no errors, transform the XML
'into HTML using the XSL stylesheet
strResults = objXMLDoc.transformNode(objXSLDoc)
else
strResults = "The following error " & _
"occurred while processing the XSL " & _
"stylesheet: <br>" & _
objXSLDoc.parseError.errorCode & ", " & _
objXSLDoc.parseError.reason
end if
else
strResults = "The following error " & _
"occurred while processing the XML " & _
"document: <br>" & objXMLDoc.parseError.errorCode & _
", " & objXMLDoc.parseError.reason
end if
else
strResults = "The following error occurred: <br>" & _
err.number & ", " & err.description
end if
TransformXML=strResults
'Clean up
set objXSLDoc = nothing
set objXMLDoc = nothing
end function
++++++++++++++++++++++++++++++++++++++++++++++++
In the XSL I have a snippet of code that looks something like this, which fails:
( when removed everything works, but I want to filter all except the match values )
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match="*[@ID='NewServers' or @ID='GRS1999']">
<xsl:copy>
OTHER XSL CODE HERE!!!
</xsl:copy>
</xsl:template>
++++++++++++++++++++++++++++++++++++++++++++++++
I have tried this:
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match="*[@ID='NewServers' | @ID='GRS1999']">
<xsl:copy>
OTHER XSL CODE HERE!!!
</xsl:copy>
</xsl:template>
++++++++++++++++++++++++++++++++++++++++++++++++
And..
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match
In the XSL I have a snippet of code that looks something like this, which fails:
( when removed everything works, but I want to filter all except the match values )
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match="*[@ID='NewServers' or @ID='GRS1999']">
<xsl:copy>
OTHER XSL CODE HERE!!!
</xsl:copy>
</xsl:template>
++++++++++++++++++++++++++++++++++++++++++++++++
I have tried this:
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match="*[@ID='NewServers' | @ID='GRS1999']">
<xsl:copy>
OTHER XSL CODE HERE!!!
</xsl:copy>
</xsl:template>
++++++++++++++++++++++++++++++++++++++++++++++++
And..
++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:for-each select="CONFIG">
<xsl:template match="@ID='NewServers' or @ID='GRS1999'">
<xsl:copy>
OTHER XSL CODE HERE!!!
</xsl:copy>
</xsl:template>
++++++++++++++++++++++++++++++++++++++++++++++++
I have had no luck making this work.. Can someone tell me a way to make my HTML show ONLY 'NewServers' AND 'GRS1999' on a page?
Thanx for your time,
--
Gavin Landon
Karland International
http://www.karland.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list