RE: Problem with XMLDOM and xsl:template macth

Subject: RE: Problem with XMLDOM and xsl:template macth
From: "Gavin Landon" <gavin@xxxxxxxxxxx>
Date: Wed, 10 May 2000 15:40:54 -0500
OK..  I have downloaded and installed MSXML3 on both my workstation and the web server and I changed the code to what you said.
I still get the same error in the same location.

I then did the :
<xsl:for-each select="CONFIG[@ID='NewServers' or @ID='GRS1999']">

and it worked GREAT!!!    THANK YOU VERY MUCH!!!!

I have one question....

Why and When should I use <xsl:copy>?   It seems to work with and without it..

*********** REPLY SEPARATOR  ***********

On 5/10/00 at 12:09 PM Jonathan Marsh wrote:

><xsl:template> is not allowed inside <xsl:for-each>, in either XSLT or the
>IE5 dialect.  I think you want this instead:
>
><xsl:for-each select="CONFIG[@ID='NewServers' or @ID='GRS1999']">
>  <xsl:copy>
>    OTHER XSL CODE HERE!!!
>  </xsl:copy>
></xsl:for-each>
>
>- Jonathan Marsh
>  Microsoft
>
>> -----Original Message-----
>> From: Gavin Landon [mailto:gavin@xxxxxxxxxxx]
>> Sent: Wednesday, May 10, 2000 10:26 AM
>> To: XSL-List@xxxxxxxxxxxxxxxx
>> Subject: Problem with XMLDOM and xsl:template macth
>>
>>
>> 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
>>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



--
Gavin Landon
Karland International
http://www.karland.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread