[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem with XMLDOM and xsl:template macth

Subject: RE: Problem with XMLDOM and xsl:template macth
From: Jonathan Marsh <jmarsh@xxxxxxxxxxxxx>
Date: Wed, 10 May 2000 12:09:29 -0700
objxmldoc.transformnode
<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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.