This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: MSXML 3.0 XSLT. Does it work?


Ok, considering Jeni's remarks, I changed you your "SearchSet" opening tag
from:

<SearchSet xmlns="urn:schemas-microsoft-com:xml-data"
           xmlns:dt="urn:schemas-microsoft-com:datatypes"
           xmlns:plss="urn:ctl.com:plss">

into:

  <SearchSet xmlns:dt="urn:schemas-microsoft-com:datatypes"
             xmlns:plss="urn:ctl.com:plss">

By removing the namespace declaration without prefix.

Then I get:

    <MIFFile 5.0> <MIFFile 4.0> <MIFFile 3.0>

This looked to be a cohabitation problem between IE5 and MSXML3. It makes
no sense. I am sure the "xsl:for-each" element works.

Anyway, I decided to make a little VbScript to check the real text output.
I called it "testss.vbs" and it generates a "testss.html" file. Here goes
the script:

    sub Main()
        dim xmlDom
        dim xslDom
        dim res
        Dim fso
        Dim ftxt

        Set xmlDom = CreateObject("MSXML2.DOMDocument")
        Set xslDom = CreateObject("MSXML2.DOMDocument")
        Set fso    = CreateObject("Scripting.FileSystemObject")

        xmlDom.load "testss.xml"
        xslDom.load "testss.xsl"

        res = xmlDom.transformNode(xslDom)

        Set ftxt = fso.CreateTextFile("testss.html", True)
        ftxt.Write res
        ftxt.Close

        ' MsgBox res
    end sub

    call Main

If you have MS Scripting installed you can run it by typing:
    WScript testss.vbs
at the DOS Prompt.

The programm is also simple to convert to any language supporting COM,
especially VB. But be aware that if you may not have the Microsoft
Scripting RunTime - for the "Scripting.FileSystemObject" object that is
used to write the resulting text to the file - installed in your
machine, if you do not have the MS Scripting Host. You will have to
write the text resulting from the transformation in another way then.


The ouput of this program shows like:

  <MIFFile 5.0><MIFFile 4.0>PL000009901<MIFFile 3.0><MIFFile
4.0>PL000009901<MIFFile 3.0>

in Internet Explorer 5. The text is:

  &lt;MIFFile 5.0&gt;&lt;MIFFile 4.0&gt;PL000009901&lt;MIFFile
3.0&gt;&lt;MIFFile 4.0&gt;PL000009901&lt;MIFFile 3.0&gt;

If you replace
               <xsl:text disable-output-escaping="no">&lt;MIFFile
4.0&gt;</xsl:text>
               <xsl:apply-templates/>
with
               <xsl:text disable-output-escaping="no">&lt;MIFFile
4.0&gt;</xsl:text>
               <xsl:apply-templates select="ItemRecord"/>
you get the desired
    <MIFFile 5.0><MIFFile 4.0><MIFFile 3.0><MIFFile 4.0><MIFFile 3.0>

The numbers where showing up due to the default template action.


You should use this kind of technique to debug your transformations in the
future.


Have fun,

Paulo Gaspar



> -----Original Message-----
> From: owner-xsl-list@mulberrytech.com
> [mailto:owner-xsl-list@mulberrytech.com]On Behalf Of sotiris@ctl.com.cy
> Sent: Wednesday, July 12, 2000 10:32
> To: xsl-list@mulberrytech.com
> Subject: Re: MSXML 3.0 XSLT. Does it work?
>
>
>
> Hi everyone,
>
> here is an example of my XML code and style sheet and the results in
> produces using MSXML 3.0.
> The stylesheet is:
>
> <xsl:stylesheet version="1.0" xmlns:xsl
> ="http://www.w3.org/1999/XSL/Transform">
>      <xsl:output method="html" indent="yes"/>
>      <xsl:template match="/">
>           <xsl:apply-templates/>
>      </xsl:template>
>      <xsl:template match="SearchSet">
>           <xsl:apply-templates/>
>      </xsl:template>
>      <xsl:template match="SearchResults">
>           <xsl:text disable-output-escaping="no">&lt;MIFFile
> 5.0&gt;</xsl:text>
>           <xsl:for-each select="RowSet">
>                <xsl:text disable-output-escaping="no">&lt;MIFFile
> 4.0&gt;</xsl:text>
>                <xsl:apply-templates/>
>           </xsl:for-each>
>      </xsl:template>
>      <xsl:template match="ItemRecord">
>           <xsl:text disable-output-escaping="no">&lt;MIFFile
> 3.0&gt;</xsl:text>
>      </xsl:template>
> </xsl:stylesheet>
>
> The XML Code is:
>
> <?xml-stylesheet type="text/xsl" href="testss.xsl"?>
> <SearchSet xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt
> ="urn:schemas-microsoft-com:datatypes" xmlns:plss="urn:ctl.com:plss">
> <SearchResults>
>      <RowSet plss:linkref="PL00000990" plss:linktype="xml">
>           <serno dt:dt="string">PL00000990</serno>
>           <hitcount dt:dt="string">1</hitcount>
>           <ItemRecord>
>                <SerNo>PL00000990</SerNo>
>           </ItemRecord>
>      </RowSet>
>      <RowSet plss:linkref="PL00000990" plss:linktype="xml">
>           <serno dt:dt="string">PL00000990</serno>
>           <hitcount dt:dt="string">1</hitcount>
>           <ItemRecord>
>                <SerNo>PL00000978</SerNo>
>           </ItemRecord>
>      </RowSet>
> </SearchResults>
> </SearchSet>
>
> and the resultant output is:
>
> PL000009901PL00000990PL000009901PL00000978
>
> What I would have expected is:
>
> <MIFFile 5.0><MIFFile 4.0><MIFFile 3.0><MIFFile4.0><MIFFile 3.0>
>
> Can anyone tell why the above is happening?  I have installed MSXML 3.0 in
> "replace" mode.
>
> Kind regards
> Sotiris, CTL, Cyprus
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]