[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: inconsistent results from stylesheet

Subject: Re: inconsistent results from stylesheet
From: Bob White <milkchaser@xxxxxxxxx>
Date: Mon, 17 Apr 2000 19:25:39 -0700 (PDT)
server inconsistent style
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.