Subject: Re: inconsistent results from stylesheet From: Bob White <milkchaser@xxxxxxxxx> Date: Mon, 17 Apr 2000 19:25:39 -0700 (PDT) |
Steve, Thanks a lot. The problem was in my sorting stylesheet. Apparently what I thought was practically an identity stylesheet is not so. By the way, I am sorting in XSL because I want to sort the result set zero or more times and I want to avoid multiple trips to the DB server. I'm already caching the result of my query as an XML DOM tree and feeding the client one page of results on request, so I figured I would use XSLT to sort the resultset if requested and avoid another query (I cannot make any assumptions about how easy/difficult it was to perform the query in the first place). I used your stylesheet and everything worked properly. Here are the two different versions. Why didn't mine work? The output of the two look nearly identical. When I print out the results of the transformations as Strings they are identical -- every element and text node is in the right place. I even printed out the Java datatype of each node and they match. I then called every method of those objects that made sense to call (getNodeName, getNodeValue, getNodeType, getQualifiedName, getLocalName, etc). Everything matched -- and yet the results of subsequent XSL transformations on my version are bizarre and undesirable. <!-- Steve's version --> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match='ROWSET'> <xsl:copy> <xsl:apply-templates select='ROW'> <xsl:sort data-type="text" order="ascending" select="./C5" /> </xsl:apply-templates> </xsl:copy> </xsl:template> </xsl:stylesheet> <!-- Bob's version --> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:strip-space elements="*"/> <xsl:template match="*|/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="text()|@*"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="/|*|@*|comment()|processing-instruction()|text()"> <xsl:copy> <xsl:apply-templates select=\"*|@*|comment()|processing-instruction()|text()"/> </xsl:copy> </xsl:template> <xsl:template match="ROWSET"> <xsl:element name="ROWSET"> <xsl:for-each select="ROW"> <xsl:sort data-type="text" order="ascending" select="./C5" /> <xsl:apply-templates select="." /> </xsl:for-each> </xsl:element> </xsl:template> </xsl:stylesheet> ===== -- Bob White -- See photos of Oxana, my beautiful bride! http://milkchaser.tripod.com 203-926-1888 x3287 "Make it legal" -- www.norml.org __________________________________________________ Do You Yahoo!? Send online invitations with Yahoo! Invites. http://invites.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: inconsistent results from style, Bob White | Thread | position() problem with // axis + p, Warren Hedley |
position() problem with // axis + p, Warren Hedley | Date | sort & remove duplicates, Mark Volkmann |
Month |