This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

inconsistent results from stylesheet


I am using the Oracle XSLT processor to translate XML into HTML.  My
XML is pulled from an Oracle DB as a DOM document, then I apply my
parsed XSL stylesheet.  Works fine the first time.

When the user requests that the results be sorted, I apply a second
stylesheet with little more than an xsl:sort command to sort the data
section of my document (all other nodes are simply copied from the
source tree to the result tree).  The sort operation leaves me with a
document-fragment.  I find the node in my original XML DOM document
that matches the root of the sorted document-fragment and I replace
that node with the sorted data.

Then I re-apply my XML-to-HTML stylesheet again to the sorted data. 
But the second time I apply my stylesheet, it does not work.

My XML looks like this:
<RESULTSET>
  <COLUMNLIST>...</COLUMNLIST>
  <ROWSET>
    <ROW>
      <C1>...</C1>
      <C2>...</C2>
      <C3>...</C3>
    </ROW>
    ...
  </ROWSET>
</RESULTSET>

What could be simpler?  I have a template for the data section that
matches on the <ROWSET> tag.

<xsl:template match="ROWSET">
  <xsl:message>
     Inside ROWSET template...
  </xsl:message>
  <xsl:for-each select="ROW[position() = ($SkipRows+1)]">
    ...
  </xsl:for-each>
</xsl:template>

The first time I apply my stylesheet, I see this message and I know
that the template is being applied as expected.  But the second time
I apply this stylesheet, this template does not fire.  Instead, I see
the default template fire for the <ROWSET> node:

<xsl:template match="*|/">
  <xsl:message>
     Applying templates from default "*|/" template,
     node:<xsl:value-of select="name()" />!!
  </xsl:message>
  ...
</xsl:template>

This puts a console message of:
     Applying templates from default "*|/" template,
     node:ROWSET!!

I have worked around this problem by naming my "ROWSET" template and
explicitly calling my ROWSET template from the "*|/" template as
follows:
  <xsl:if test="name()='ROWSET'">
    <xsl:call-template name="insert-rowset"/>
  </xsl:if>

This works, but shouldn't the template fire based on the
match="ROWSET" attribute?  
<xsl:template match="ROWSET" name="insert-rowset">
    ...
</xsl:template>

Is this a bug in the Oracle processor?

..Bob.

=====
-- 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]