Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Read xml from SQL server >Thread Next - Re: Read xml from SQL server Re: Read xml from SQL serverTo: NULL Date: 3/5/2005 9:33:00 AM It must be my transformation. I will include the XML and XSL below but the
save response returns the correct sql. It displays correctly when I pull
them from local files but not over http. When I do it over http I get a
blank page but when I look at the source code there is a table but no
content. It's as if the xsl can't find the nodes. What obvious thing am I
doing wrong !!
Here is the XML
<root>
<dbo.tblCategories CategoryID="1"
Category="Category1"><dbo.tblSubCategories SubCategoryID="1"
SubCategoryName="SubCategory1"/><dbo.tblSubCategories SubCategoryID="2"
SubCategoryName="SubCategory2"/><dbo.tblSubCategories SubCategoryID="3"
SubCategoryName="SubCategory3"/></dbo.tblCategories><dbo.tblCategories
CategoryID="2" Category="Category2"><dbo.tblSubCategories SubCategoryID="4"
SubCategoryName="SubCategory4"/><dbo.tblSubCategories SubCategoryID="5"
SubCategoryName="SubCategory5"/><dbo.tblSubCategories SubCategoryID="6"
SubCategoryName="SubCategory6"/></dbo.tblCategories>
</root>
Here is the XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="catid">1</xsl:param>
<xsl:template match="/">
<table>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="dbo.tblCategories">
<tr><td bgcolor="#EEEEEE"><xsl:value-of select="@Category"/></td></tr>
<xsl:for-each select="dbo.tblSubCategories">
<tr><td><xsl:value-of select="@SubCategoryName"/></td></tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
"Han" <hp4444@k...> wrote in message
news:#U#C1yTIFHA.2276@T......
> Hi Chris. Blank page is not an error. Problem is response.write. If the
xml
> has values only on attributes, there is nothing to show when you do
> response.write. First try to render the xml as xml instead of text. e.g.,
>
> response.contentType="text/xml"
> xmldoc.save response
>
> If problem still persists, let us know that. If it renders properly, now
we
> can discuss the xslt issue.
>
> --
> Pohwan Han. Seoul. Have a nice day.
> "Joe Fawcett" <joefawcett@h...> wrote in message
> news:uLURPCDIFHA.2984@T......
> > "Chris Kennedy" <ck001s7253nospam@b...> wrote in message
> > news:OX1t2zCIFHA.3444@T......
> >>I have an SQL Server outputting some XML - when I put the XML in a text
> >>file
> >> and load it via the C drive it loads. When I try it over http the page
> >> doesn't display any data. I have playing around with streams but I
can't
> >> get
> >> it to work. Can anyone point me in the right direction
> >>
> >>
> >> set xmlDoc = CreateObject("microsoft.xmldom")
> >> set xslDoc = CreateObject("microsoft.xmldom")
> >> set strXML = CreateObject("adodb.stream")
> >>
> >> xmlDoc.async = false
> >> xslDoc.async = false
> >>
> >> strXML.open
> >> strXML.WriteText "http://localhost/nav/template/sqltemp.xml",
adWriteChar
> >>
> >> xmldoc.load(server.mappath("nav.xml")) - this works
> >> xmldoc.load(strXML.ReadText) - this doesn't
> >> xsldoc.load(server.mappath("xsl.xsl"))
> >>
> >> strout = xmlDoc.transformNode(xsldoc)
> >>
> >>
> > You don't need to use a stream if the url returns xml, just use
> > domdocument.load(url) or xmlhttp class.
> >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html
/dom_reference.asp?frame=true
> >
> >
> > --
> >
> > Joe (MVP)
> >
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
