xml in asp and xsl 
Author Message
 xml in asp and xsl

Hi
Im using the asp script to put data from a DB to XML. This works fine, now
Im trying to use a XSL Stylesheet for formatting the output but it seems
that the xsl file isnt used.
I can delete the file and no error message occures. If I copy the xml
section from my asp file into a xml file and delete the ASP tags <%= and  %>
all works fine.
Any ideas???
Thanx
    Bj?rn Berger
---------------------Asp with XML
file------------------------------------------------------

<!-- #include file="DBconnect.inc" -->
<%
dim cDate
dim oSqlget
dim cSql
dim aJobdata
dim cName
dim cUserID
dim cNextcontact
dim cMemo
dim cProjektname
aJobdata  = array()
'-------------create and fill sql object-----------------------------------
set oSqlget = Server.CreateObject("ADODB.Recordset")
cSQLget = session("cSqlstring")
oSqlget.Open cSQLget, cnn
'-------------convert sql object in an array and input in session----------
cSql = oSqlget.GetRows()
cspalten = UBound(cSql, 2)
czeilen = UBound(cSql, 1)
session("aData") = cSql
'-------------write session object to strings------------------------------
aJobdata= session("aData")
cName = session("cName")
cDate = Date
cProjektname  = aJobdata(0,0)
'-------------close sql object---------------------------------------------
oSqlget.close
cnn.close
set oSqlget = Nothing
%>
<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml:stylesheet type="text/xsl" href="diSalesforce.xsl"?>
<Data>
    <HEADER>
 <Projektname><%=cProjektname%></Projektname>
 <User><%=cName%></User>
 <date><%=cDate%></date>
    </HEADER>
<%
for i=0 to cspalten
 cOrganisation1 = aJobdata(1,i)
 cOrganisation2 = aJobdata(2,i)
%>
    <OUTPUT>
 <nextcontact><%=cOrganisation1%></nextcontact>
 <memo><%=cOrganisation2%></memo>
    </OUTPUT>
<%
next
%>
</Data>
--------------XSL File----------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=" http://www.*-*-*.com/ ;
version="1.0">
<xsl:template match="/">
 <html>
  <style>
   TD {font-size:9pt}
  </style>
  <BODY STYLE="font:9pt Verdana">
        <H3>IBS-Salesforce</H3>
        <TABLE BORDER="1">
          <TR>
            <TD><B>Header</B></TD>
          </TR>
    <xsl:for-each select="Data">
       <TR>
            <TD>    <xsl:value-of select="HEADER/Projektname"/></TD>
       </TR>
       <TR>
            <TD><xsl:value-of select="HEADER/User"/></TD>
       </TR>
 <TR>
            <TD><xsl:value-of select="HEADER/date"/></TD>
       </TR>
     </xsl:for-each>
   </TABLE>
   <br></br>
          <TABLE BORDER="1">
          <TR>
            <TD><B>Daten</B></TD>
          </TR>
    <xsl:for-each select="Data">
       <TR>
            <TD>    <xsl:value-of select="OUTPUT/nextcontact"/></TD>
       </TR>
       <TR>
            <TD>    <xsl:value-of select="OUTPUT/memo"/></TD>
       </TR>
    </xsl:for-each>
   </TABLE>
  </BODY>
  </html>
 </xsl:template>
</xsl:stylesheet>


Sat, 19 Jul 2003 19:50:08 GMT  
 xml in asp and xsl
Berger says:

Quote:
>Hi
>Im using the asp script to put data from a DB to XML. This works fine, now
>Im trying to use a XSL Stylesheet for formatting the output but it seems
>that the xsl file isnt used.
>I can delete the file and no error message occures. If I copy the xml
>section from my asp file into a xml file and delete the ASP tags <%= and  %>
>all works fine.
>Any ideas???

(code snipped)

It looks like the simplest answer for what you're trying to do would
be to set the mime header to XML, as follows:

Response.ContentTyle = "text/xml"

Perhaps a better way, though, would be to use the Microsoft.XMLDOM
component,  which could provide some error checking, and more
importantly, would return HTML to the browser, since most browsers
don't correctly display XML / XSL

----------
Randy Hunt
MCP+I / MCSE



Sun, 20 Jul 2003 08:16:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO VBScript, SAP - ABAP

2. Render XML+XSL into PrintDocument (not XML) ?

3. Jscript and XML/XSL Help

4. RE-XML+XSL=>Postscript

5. JavaScript and XML/XSL

6. xml sorting with xsl

7. Resizing an IFrame with XML content transformed with XSL to full size of content

8. Client side XML/XSL/DOM in IE

9. XML-XSL Transformation

10. Convert DataTable XML to CSV Using XSL

11. render Hello.xml + Hello.xsl into PrintDocument ?

12. VB and XML/XSL

 

 
Powered by phpBB® Forum Software