Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cutever
Starting Member
32 Posts |
Posted - 2002-09-17 : 04:41:31
|
| Products.xml<?xml version="1.0" ?><ProductList xmlns:sql='urn:schemas-microsoft-com:xml-sql' sql:xsl='Products.xsl'> <sql:header sql:nullvalue='NoCategory'> <sql:param name='CategoryID'>NoCategory</sql:param> </sql:header> <sql:query xmlns:sql='urn:schemas-microsoft-com:xml-sql'> If (@CategoryID is NULL) Select ProductID, ProductName, UnitPrice From Products For XML Auto, Elements Else Select ProductID, ProductName, UnitPrice From Products where CategoryID = @CategoryID For XML Auto, Elements </sql:query></ProductList>Products.xsl<?xml version='1.0' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = '/'> <HTML> <HEAD><TITLE>Product List</TITLE> <META HTTP-EQUIV='Content-Type' Content='text/html; CHARSET=utf-8'></META> </HEAD> <BODY> <H2>Product List</H2> <TABLE> <TR> <TD><B>Product </B></TD> <TD><B>Price</B></TD> </TR> <xsl:for-each select='ProductList/Products'> <TR> <TD><xsl:value-of select='ProductName'/></TD> <TD><xsl:value-of select='UnitPrice'/></TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML> </xsl:template> </xsl:stylesheet>Could any one please tell me what problem is it ? I’ve checked both xml and xsl file, there was error free. However, when I try to link it together, it’s prompt me following error…………….The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. End tag 'HEAD' does not match the start tag 'META'. Error processing resource 'http://192.168.1.232:103//sql/Template/TemplateXSL/Products.xml?CategoryID=1'. Line 7, Position 3 </HEAD>--^Ver |
|
|
jasper_smith
SQL Server MVP & SQLTeam MVY
846 Posts |
Posted - 2002-09-17 : 08:33:21
|
| Change the META TAG to<META HTTP-EQUIV='Content-Type' Content='text/html; CHARSET=utf-8'/> You don't really need it in your XSL like that as if you examine the source of yout output you'll see 2 META tags. You can use the <xsl:output media-type='text/html'/> directive instead i.e.<?xml version='1.0' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output media-type='text/html'/><xsl:template match = '/'> <HTML> <HEAD><TITLE>Product List</TITLE> </HEAD> <BODY> <H2>Product List</H2> <TABLE> <TR> <TD><B>Product </B></TD> <TD><B>Price</B></TD> </TR> <xsl:for-each select='ProductList/Products'> <TR> <TD><xsl:value-of select='ProductName'/></TD> <TD><xsl:value-of select='UnitPrice'/></TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML> </xsl:template> </xsl:stylesheet> HTHJasper Smith |
 |
|
|
|
|
|
|
|