RE: MSXML 4 - RowSetSchema XML
> Q: How do I write the XSL to detect a missing rowset attribute? I want > to add whitespace to the cell to keep the data set lined up in the correct > columns. One way is to test to see if the element has all of the attributes by specifying them in the XSLT: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="root"> <xsl:text> Nodes without A: </xsl:text> <xsl:apply-templates select="child::*[not(@a)]"/> <xsl:text> Nodes without B: </xsl:text> <xsl:apply-templates select="child::*[not(@b)]"/> <xsl:text> Nodes without C: </xsl:text> <xsl:apply-templates select="child::*[not(@c)]"/> </xsl:template> <xsl:template match="*"> <xsl:value-of select="local-name()"/> <xsl:if test="position() != last()"> <xsl:text>,</xsl:text> </xsl:if> </xsl:template> </xsl:stylesheet> Given the input document: <root> <foo a="1" b="2" c="3"/> <bar a="1"/> <baz a="1" b="2"/> </root> The result is: Nodes without A: Nodes without B: bar Nodes without C: bar,baz This may fit your scenario because you specified you were using ADO and the RowSetSchema , where you will always have a fixed number of attributes for each of the s:AttributeType elements. This approach does not work well for the child s:DataType element, where the number of attributes is determined by the datatype itself (a type of "int" will have an "rs:precision" attribute, while a type of "string" will not). This approach is not very reusable in different instances because you rely on the same attributes to be present for each element. You could just take the approach of finding out the maximum number of attributes  that an element may have and use that when generating the table.  http://gethelp.devx.com/techtips/xml_pro/10min/10min0100/listing2.htm  http://www.topxml.com/code/default.asp?p=3&id=v20030314165921 -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of tbstewart@xxxxxxx Sent: Friday, February 06, 2004 8:05 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: MSXML 4 - RowSetSchema XML Hi, I am using MSXML 4.0 to perform server-side (memory resident) transformations in my Classic ASP Web application. The default XML that ADO generates is a combination of the schema and the XML in what MS calls a RowSetSchema. The problem with using the XML as is, is that when a data item is null the node's attribute is not included in the rowset. Hence, the report's table cell is not preserved and the remaining data columns shift one or more columns to the left. Q: How do I write the XSL to detect a missing rowset attribute? I want to add whitespace to the cell to keep the data set lined up in the correct columns. Thanks for your help. Cheers, --Tom XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format