Trouble with transformNodes ...

Trouble with transformNodes ...

Post by Ram Cherukur » Fri, 07 Jun 2002 23:00:04



Hello!

am trying to use transformNodes method in DOM to format my
xml data. the xml and xsl files are:

----------------------------
<?xml version="1.0" ?>
<?xml:stylesheet type="text/xsl" href="a.xsl" ?>
<EMAIL>
<LINE>Congratulations!  You are now registered.  
        </LINE>
<BLANK/>
<LINE>PLEASE SAVE OR PRINT THIS MESSAGE.  
        </LINE>
<BLANK/>
<LINE>Your ID number:  00000032190                
        </LINE>
<BLANK/>
</EMAIL>
----------------------------
<?xml version="1.0"?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text'/>
<xsl:preserve-space elements='*'/>

<xsl:template match='EMAIL'>
<xsl:for-each select='LINE'>
<children/>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match='BLANK'>
</xsl:template>

</xsl:stylesheet>
----------------------------

I create two DOMDocument objects and load the xml and xsl
files into each of these objects. there are no parse
errors.

dim xmlObject as object
dim xslObject as object
set xmlObject = CreateObject("MSXML2.DOMDocument")
set xslObject = CreateObject("MSXML2.DOMDocument")
xmlObject.async = False
xslObject.async = False

bResult = xmlObject.Load("c:\temp\a.xsl")
bResult = xslObject.Load("c:\temp\a.xsl")

but when I call the transformNodes method, as:

strResult = xmlObject.transformNodes(xslObject)

I get a 'Type Mismatch' error! there are no parse errors.

this works fine if I use the command prompt utility for
transformation, as:

msxsl a.xml a.xsl -o a.txt

any ideas???

 
 
 

Trouble with transformNodes ...

Post by Stuart Celarie » Sat, 08 Jun 2002 16:10:46


Ram

Quote:> bResult = xmlObject.Load("c:\temp\a.xsl")
> bResult = xslObject.Load("c:\temp\a.xsl")

Examine these two lines very carefully. They are a little too similar,
differing in exactly one character.

Quote:> any ideas???

More distinctive names (file names and variable names) would make this kind
of error much easier to spot or avoid in the first place.

Cheers,
Stuart
--
Stuart Celarier, Fern Creek, www.ferncrk.com
Consultant on .NET, Win32, C#, C++, COM, XML, XSLT and more.

 
 
 

Trouble with transformNodes ...

Post by Vince C » Fri, 14 Jun 2002 22:42:35



Quote:> Ram

> > bResult = xmlObject.Load("c:\temp\a.xsl")
> > bResult = xslObject.Load("c:\temp\a.xsl")

> Examine these two lines very carefully. They are a little too similar,
> differing in exactly one character.

This is the long form for:
? bResult = xmlObject.Load("c:\temp\a.xsl")

should be

bResult = xmlObject.Load("c:\temp\a.xml") ?

;-)

Vince C.

 
 
 

1. Trouble with transformNodes in DOM ...

Hello!

am trying to use transformNodes method in DOM to format my
xml data. the xml and xsl files are:

----------------------------
<?xml version="1.0" ?>
<?xml:stylesheet type="text/xsl" href="a.xsl" ?>
<EMAIL>
<LINE>Congratulations!  You are now registered.  
        </LINE>
<BLANK/>
<LINE>PLEASE SAVE OR PRINT THIS MESSAGE.  
        </LINE>
<BLANK/>
<LINE>Your ID number:  00000032190                
        </LINE>
<BLANK/>
</EMAIL>
----------------------------
<?xml version="1.0"?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text'/>
<xsl:preserve-space elements='*'/>

<xsl:template match='EMAIL'>
<xsl:for-each select='LINE'>
<children/>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match='BLANK'>
</xsl:template>

</xsl:stylesheet>
----------------------------

I create two DOMDocument objects and load the xml and xsl
files into each of these objects. there are no parse
errors.

dim xmlObject as object
dim xslObject as object
set xmlObject = CreateObject("MSXML2.DOMDocument")
set xslObject = CreateObject("MSXML2.DOMDocument")
xmlObject.async = False
xslObject.async = False

bResult = xmlObject.Load("c:\temp\a.xsl")
bResult = xslObject.Load("c:\temp\a.xsl")

but when I call the transformNodes method, as:

strResult = xmlObject.transformNodes(xslObject)

I get a 'Type Mismatch' error! there are no parse errors.

this works fine if I use the command prompt utility for
transformation, as:

msxsl a.xml a.xsl -o a.txt

any ideas???

2. about creating menu using user ctrls in asp.net

3. having trouble with the MSXML transformNode results.

4. GRADD D.077 where are you?

5. Trouble with Schema/TransformNode()

6. Wazzup with GEOS?

7. having trouble with the MSXML transformNode results.

8. Pocket PC 2002 Upgrade

9. XSLT Troubles

10. xml trouble in getting values

11. Having trouble with XPATH

12. trouble with FOP

13. msxsl-trouble (newbie)