xsl-list
[Top] [All Lists]

Re: [xsl] XPath problem with getting all ancestors

2009-10-23 10:46:16
The actual template does more than copying; it uses recursion to group sections started by headlines at different levels defined by its attributes. I got it from this post:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200910/msg00228.html

The function works really well (except for cases when a headline level is skipped). So if its possible to keep copying the nodes it would be great; otherwise I'll have to fix the function (I'm thinking of expanding the recursion into four xls:for-each-group statements - it's not allowed to go deeper anyway).

I'll do sone further testing once I get back to the computer.

Regards
Jostein

Den 23. okt. 2009 kl. 15.20 skrev "Michael Kay" <mike(_at_)saxonica(_dot_)com>:

   <xsl:template match="article">
       <xsl:variable name="v1">
           <xsl:copy-of select="content/node()"/>
       </xsl:variable>
       <xsl:sequence select="mf:group($v1/node())"/>
   </xsl:template>

As I suspected, you are copying the nodes, and the copies do not have the
same ancestors.

It's not clear to me WHY you are copying them - it seems quite unnecessary.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--