This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Problem: XSL with MSXML3.0SP1 and MS SQL Server2000
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Problem: XSL with MSXML3.0SP1 and MS SQL Server2000
- From: "Ruairi" <ruairi at rutlands dot com>
- Date: Wed, 15 Aug 2001 18:11:09 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Anyone using XSL with MSXML3.0 SP1 and MS SQL Server2000? I have the
following problem:
The following XML and XSL work perfectly as standalone files. When I use
SQL Server to dynamically create the XML it does perfectly. Then when I
include the XSL attribute in the XML I get a internal server error no. 500.
Any suggestion are appreciated.
Original XML to SQL Server:
<?xml version="1.0"?>
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:xsl='login.xsl'>
<sql:header>
<sql:param name='user'>Dublin</sql:param>
<sql:param name='pass'>adminpw</sql:param>
</sql:header>
<sql:query>
<![CDATA[
select * from Users
where place = @user and password = @pass
for xml auto
]]>
</sql:query>
</ROOT>
Resulting XML from SQL Server (without XSL post-process):
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<Users place="Albany" name="Fruit from the Forest" groups="store"
password="adminpw" email="Albany@scooters.com" account="500" currency="USD"
line="15 Main St" zip="12201" state="New York" country="US" />
</ROOT>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" media-type="text/html" version="1.0"
standalone="yes" indent="yes"/>
<xsl:template match="/">
<html><body>
<xsl:choose>
<xsl:when test="ROOT/Users/@groups ='store'">
<xsl:apply-templates select="/ROOT/Users" mode="login.store.success"/>
</xsl:when>
<xsl:when test="ROOT/Users/@groups = 'supplier'">
<xsl:apply-templates select="/ROOT/Users"
mode="login.supplier.success"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="login.fail"/>
</xsl:otherwise>
</xsl:choose>
</body></html>
</xsl:template>
<xsl:template name="login.fail">
<form method="post" action="http://localhost/549/temp/ex71e.xml">
Name:<input type="text" name="user"/><br/>
Password:<input type="text" name="pass"/><br/>
<input type="submit" value="Login"/>
<input type="hidden" name="xsl" value="login.xsl"/>
</form>
</xsl:template>
<xsl:template match="Users" mode="login.store.success">
<p align="center">Hi <xsl:value-of select="@name"
disable-output-escaping="yes" />.
Your Account is: <xsl:value-of select="format-number(@account,'#,##0.00')"
disable-output-escaping="yes" />
(<xsl:value-of select="@currency" disable-output-escaping="yes" />).
</p>
</xsl:template>
<xsl:template match="Users" mode="login.supplier.success">
<p align="center">Hi <xsl:value-of select="@place"
disable-output-escaping="yes" />.
Your Account is: <xsl:value-of
select="format-number(@account,'#,##0.00')" disable-output-escaping="yes" />
(<xsl:value-of select="@currency" disable-output-escaping="yes"
/>).<br/>
</p>
</xsl:template>
</xsl:stylesheet>
Regards,
-Ruairi
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list