xsl-list
[Top] [All Lists]

RE: preceding-sibling question and node set as param to tem plate

2002-12-11 07:05:26
Hi Matt

1) nearly.
count(preceding-sibling::node()/@ss:Index/preceding-sibling::node())
you're asking for the preceding sibling of an attribute... 
Make the test for the attribute part of how you select the first node, and
just select the first...
        
        
count(preceding-sibling::node()[(_at_)ss:Index][1]/preceding-sibling::node())

2) yes. Don't use copy-of, just use select.
        
        <xsl:with-param name="pp" select="preceding-sibling::node()"/>

have fun
Tom SW


-----Original Message-----
From: Matts Isuls [mailto:matts(_dot_)isuls(_at_)AGROLINK(_dot_)FI]
Sent: 11 December 2002 13:54
To: 'XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] preceding-sibling question and node set as param to
template


Hi list


Working with MS-Excel XML files and has run into something i 
can't resolve
on my own. 

q1::

What i would like to do is this:

Get first preceding-sibling of current node that has the 
ss:Index attrib
set. Then count the 'ss:Index' node's preceding-siblings. I hope you
understand what i mean. 

count(preceding-sibling::node()/@ss:Index/preceding-sibling::node())
but it doesn't work. result = 0


q2::

Is it possible to send a node set to a template as param? 
Something like
this below?

<xsl:template match="/">
...
...
    <xsl:for-each select="ss:Cell">
      <xsl:call-template name="testlate">
        <xsl:with-param name="pp"><xsl:copy-of
select="preceding-sibling::node()"/></xsl:with-param>
      </xsl:call-template>
    </xsl:for-each>
...
...
</xsl:template>


<xsl:template name="testlate">
  <xsl:param name="pp"/>
  <!-- do this and that -->
  <xsl:value-of select="count($pp)"/>
</xsl:template>


Matts Isuls

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • RE: preceding-sibling question and node set as param to tem plate, TSchutzerWeissmann <=