xsl-list
[Top] [All Lists]

Re: [xsl] hierarchic counting in flat structures

2012-11-02 08:52:41
Hi Michael,

[Michael Kay]:
<xsl:number from="H3" level="any"/>

It's not the usual use case given for level="any", but I think it
should work, provided that an H3 actually exists.

That works - almost. :-)
One detail remains to be dealt with.

The input XML I am working on is not the most professional one. ;-)

<DOK>
<H3>…</H3>
  <H4>…</H4>          <- "outer H4"
  <some>
    <tag>
      <H4>…</H4>          <- "inner H4"
    </tag>
  </some>
  <H4>…</H4>         <- "outer H4"
  …
</DOK>

Of course, your solution counts all the "inner H4", too.
However, I don't want these to be be considered.

So, I extend your proposal a bit:
<xsl:number count="DOK/H4" from="H3" level="any"/>

And there we go - this yields the result I have been looking for.

Thanks for your help,
best wishes,
Norbert

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