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

RE: Document Function Befuddlement

Subject: RE: Document Function Befuddlement
From: "Signature House" <systems@xxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Jan 2008 12:59:49 -0500
RE:  Document Function Befuddlement
William Charlton wrote:
-> Assuming you are using JavaScript to process the transform, could you show
-> your JavaScript or a link to the page you are testing on?
->
-> It is possible that there is a problem there.
->

William,

I included everything I'm using in the original post - no Javascipt, I simply open the 'list nodes.xml' in IE and everything runs
from that. And I'm doing it all local, so no link.

*****************************************************************

Scott Trenda wrote:
-> Well, the second one makes sense; descendant-or-self::* also selects
-> root nodes, and each new document has a root node. Also, your stylesheet
-> would probably be more easily debugged by using these in the <for-each>:
->
-> <td><xsl:number/></td>
-> <td><xsl:value-of select="name()"/></td>
-> <td><xsl:value-of select="normalize-space()"/></td>
->
-> That'll give you the position in the source document (instead of the
-> position in the context node-set), the name of the context node,
-> whatever it may be (avoid any self:: restriction confusion here), and
-> the native string-value of the node. Perhaps then it'll be clear as to
-> what exactly the processor is computing.
->
->

Scott,

I added the 3 statements you provided (in parallel with what was already there) and added in a bit more of the original template
that I took the sample from to get more info (level & path to the node) and re-ran it with both variations
['/daily/descendant-or-self::node()' and 'descendant-or-self::node()'].

I've included the new code below and the results. Strangely, the number element produced all 1's. And the
'descendant-or-self::node()' version contains an contains an additional first line that isn't present in the
'/daily/descendant-or-self::node()' variation.


I'm still working on Michael Kay's suggestion to try another processor.

Mike McBee
Signature House
systems@xxxxxxxxxxxxxxxxxx
www.signaturehouse.net
304-842-3386


monthly process.xml
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
 <table border="1">
  <xsl:variable name="monthly_link" select="document('monthly list.xml')/monthly/day"/>
  <tr><td>Pos</td><td>Level</td><td>Path</td><td>Name</td><td>Value</td></tr>

  <xsl:for-each select="document($monthly_link/@link)SEE BELOW">

   <tr>
    <td>{<xsl:number value="position()"/>}-{<xsl:number/>}</td>
    <td><xsl:value-of select="count(ancestor-or-self::*)"/></td>
    <td>
     <xsl:for-each select="ancestor::node()">
      <xsl:value-of select="name()"/>
      <xsl:text>/</xsl:text>
     </xsl:for-each>
    </td>
    <td>{<xsl:value-of select="name(self::node())"/>}-{<xsl:value-of select="name()"/>}</td>
    <td>{<xsl:value-of select="normalize-space(text())"/>}-{<xsl:value-of select="normalize-space()"/>}</td>
   </tr>

  </xsl:for-each>

 </table>
</xsl:template>
</xsl:stylesheet>


/daily/descendant-or-self::node() variation:

Pos      Level Path                Name              Value
---      ----- ------------------- ----------------- -----
{1}-{1}  1     /                   {daily}-{daily}   {}-{1 John}
{2}-{1}  2     /daily/             {client}-{client} {}-{1 John}
{3}-{1}  3     /daily/client/      {day}-{day}       {1}-{1}
{4}-{1}  3     /daily/client/day/  {}-{}             {}-{1}
{5}-{1}  3     /daily/client/      {name}-{name}     {John}-{John}
{6}-{1}  3     /daily/client/name/ {}-{}             {}-{John}
{7}-{1}  1     /X{daily}-{daily}                     {}-{2 Margaret}
{8}-{1}  2     /daily/             {client}-{client} {}-{2 Margaret}
{9}-{1}  3     /daily/client/      {day}-{day}       {2}-{2}
{10}-{1} 3     /daily/client/day/  {}-{}             {}-{2}
{11}-{1} 3     /daily/client/      {name}-{name}     {Margaret}-{Margaret}
{12}-{1} 3     /daily/client/name/ {}-{}             {}-{Margaret}


descendant-or-self::node() variation:

Pos      Level Path                Name              Value
---      ----- ------------------- ----------------- -----
{1}-{1}  0                         {}-{}             {}-{1 John}
{2}-{1}  1     /                   {daily}-{daily}   {}-{1 John}
{3}-{1}  2     /daily/             {client}-{client} {}-{1 John}
{4}-{1}  3     /daily/client/      {day}-{day}       {1}-{1}
{5}-{1}  3     /daily/client/day/  {}-{}             {}-{1}
{6}-{1}  3     /daily/client/      {name}-{name}     {John}-{John}
{7}-{1}  3     /daily/client/name/ {}-{}             {}-{John}

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.