Re: [xsl] XSL Processing to avoid repetitions - Part 2

Subject: Re: [xsl] XSL Processing to avoid repetitions - Part 2
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 17 Jun 2010 10:06:01 +0100
Saxon-HE 9.2 doesn't recognize the function exslt:node-set(). It's actually a no-op in XSLT 2.0, so a workaround is to add the following to your stylesheet:

<xsl:function name="exslt:node-set" xmlns:exslt="http://exslt.org/common"; as="node()?>
<xsl:param name="node" as="node()?/>
<xsl:sequence select="$node"/>
</xsl:function>


If you don't want to modify the docbook stylesheets you could put this in a stylesheet that imports docbook.xsl, and then use your importing stylesheet as the entry point.

I don't have detailed knowledge of the status, but although the XSLT 2.0 docbook stylesheets are still described as expermental, I get the impression that many people are using them without problems.

Michael Kay
Saxonica

On 17/06/2010 09:48, Fabien Tillier wrote:
Hi.
So, now I have an XSL Stylesheet that did work nicely.
My problem is that I am using the docbook stylesheets, which are expecting an XSLT processor 1.0.
I have used Kernow for testing (so Saxon) and then added Saxon (9) to my java app.
Sadly, my app failed when transforming my docbook xml to html because my XSLT processor is now saxon, and not the default 1.0 one (or so I assume it is the case).
I know the XSLT 2.0 version of the DB stylesheets are experimental, thus I cannot use them (or so it seems).
I have two options.
	- change the XSL provided to a version 1.0 (thus, as I just understood the 2.0 fashion, and version 1.0 seems a lot more complicated, I am a bit afraid)
	- use a different processor "on demand" (which seems complicated too), either Java internal Xalan or saxon.

Or I may be completely wrong (when using saxon in my app, the message I get is
Error on line 357 of docbook.xsl:
   Cannot find a matching 1-argument function named {http://exslt.org/common}node-set()
; SystemID: jndi:/localhost/CerepWeb/xsl/docBook/xsl/html/docbook.xsl; Line#: 357; Column#: -1
net.sf.saxon.trans.XPathException: Cannot find a matching 1-argument function named {http://exslt.org/common}node-set()
)

Any help from you, guys ?
Best regards,
Fabien


-----Message d'origine----- De : Fabien Tillier [mailto:f.tillier@xxxxxxxx] Envoyi : mercredi 16 juin 2010 16:37 @ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx Objet : RE: [xsl] XSL Processing to avoid repetitions

Yes !
Sorry for being so blind.
Your code works. It is just (I think) that I was messing with the way to set the "fields"
Thanks a lot
Best regards,
Fabien


-----Message d'origine----- De : Martin Honnen [mailto:Martin.Honnen@xxxxxx] Envoyi : mercredi 16 juin 2010 16:30 @ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx Objet : Re: [xsl] XSL Processing to avoid repetitions

Fabien Tillier wrote:

Thanks for your answer, but it doesn't work for me.
I have resent a message with my real data.
Maybe your solution would work if I don't change it to fit my data :)
Andrew already suggested what to do, you simply can nest for-each-group e.g.

<ol>
    <xsl:for-each-group select="/Results/Row" group-by="CONTRACT">
      <li>
        <xsl:value-of select="current-grouping-key()"/>
        <ol>
          <xsl:for-each-group select="current-group()" group-by="CODE">
            <li>
              <xsl:value-of select="current-grouping-key()"/>
              <ol>
                <xsl:for-each select="current-group()/NUMERO">
                  <li>
                    <xsl:value-of select="."/>
                  </li>
                </xsl:for-each>
              </ol>
            </li>
          </xsl:for-each-group>
        </ol>
      </li>
    </xsl:for-each-group>
</ol>

Current Thread