DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Transforming XML based on an ADO recordset

  1. #1
    Larry Hunter Guest

    Transforming XML based on an ADO recordset




    Hi -

    This is really really basic question. I am experimenting with XML data sets
    that are based on ADO data sets. I set up a very simple program to query
    the database and then return/save the data in an XML file.

    Now, I want to design a series of XSL style sheets that will transform that
    data into whatever I want. However, when I attempt to do so I get the error:

    Reference to Undelcared name space "z"

    The XSL sheet code is below.


    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
    <html>
    <body bgColor="gold">
    <table border="1">
    <tr>
    <td><b>Employee ID</b></td>
    <td><b>First Name</b></td>
    <td><b>Last Name</b></td>
    </tr>
    <xsl:for-each select="//z:row">
    <tr>
    <td><xsl:value-of select="EMPID"/></td>
    <td><xsl:value-of select="FIRSTNAME"/></td>
    <td><xsl:value-of select="LASTNAME"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>

    </xsl:template>
    </xsl:stylesheet>


  2. #2
    jason phelps Guest

    Re: Transforming XML based on an ADO recordset


    Larry,

    The ADO recordset XML format is in the Microsft XDR schema, governed by a
    series of namespaces that you will need to declare in order to reference
    them.

    Try these to NS declarations on yout stylesheet tag

    xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"

    Jason

    "Larry Hunter" <Hunterlmc@hotmail.com> wrote:
    >
    >
    >
    >Hi -
    >
    >This is really really basic question. I am experimenting with XML data

    sets
    >that are based on ADO data sets. I set up a very simple program to query
    >the database and then return/save the data in an XML file.
    >
    >Now, I want to design a series of XSL style sheets that will transform that
    >data into whatever I want. However, when I attempt to do so I get the error:
    >
    >Reference to Undelcared name space "z"
    >
    >The XSL sheet code is below.
    >
    >
    ><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    ><xsl:template match="/">
    ><html>
    ><body bgColor="gold">
    ><table border="1">
    ><tr>
    > <td><b>Employee ID</b></td>
    > <td><b>First Name</b></td>
    > <td><b>Last Name</b></td>
    ></tr>
    > <xsl:for-each select="//z:row">
    > <tr>
    > <td><xsl:value-of select="EMPID"/></td>
    > <td><xsl:value-of select="FIRSTNAME"/></td>
    > <td><xsl:value-of select="LASTNAME"/></td>
    > </tr>
    > </xsl:for-each>
    ></table>
    ></body>
    ></html>
    >
    ></xsl:template>
    ></xsl:stylesheet>
    >



  3. #3
    Larry Hunter Guest

    Re: Transforming XML based on an ADO recordset




    Many thanks!!! It worked like a charm. I was getting tired of having to
    perform two different transformations on the ADO datasets.

    Larry



    "jason phelps" <jason@iksworks.com> wrote:
    >
    >Larry,
    >
    >The ADO recordset XML format is in the Microsft XDR schema, governed by

    a
    >series of namespaces that you will need to declare in order to reference
    >them.
    >
    >Try these to NS declarations on yout stylesheet tag
    >
    >xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"
    >
    >Jason
    >
    >"Larry Hunter" <Hunterlmc@hotmail.com> wrote:
    >>
    >>
    >>
    >>Hi -
    >>
    >>This is really really basic question. I am experimenting with XML data

    >sets
    >>that are based on ADO data sets. I set up a very simple program to query
    >>the database and then return/save the data in an XML file.
    >>
    >>Now, I want to design a series of XSL style sheets that will transform

    that
    >>data into whatever I want. However, when I attempt to do so I get the

    error:
    >>
    >>Reference to Undelcared name space "z"
    >>
    >>The XSL sheet code is below.
    >>
    >>
    >><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    >><xsl:template match="/">
    >><html>
    >><body bgColor="gold">
    >><table border="1">
    >><tr>
    >> <td><b>Employee ID</b></td>
    >> <td><b>First Name</b></td>
    >> <td><b>Last Name</b></td>
    >></tr>
    >> <xsl:for-each select="//z:row">
    >> <tr>
    >> <td><xsl:value-of select="EMPID"/></td>
    >> <td><xsl:value-of select="FIRSTNAME"/></td>
    >> <td><xsl:value-of select="LASTNAME"/></td>
    >> </tr>
    >> </xsl:for-each>
    >></table>
    >></body>
    >></html>
    >>
    >></xsl:template>
    >></xsl:stylesheet>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center