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

Re: question on EXSLT data partitioning

Subject: Re: question on EXSLT data partitioning
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Thu, 21 Oct 2010 12:56:13 +0200
Re:  question on EXSLT data partitioning
Erwan,

I just tested your new solution, and it works for xsltproc as well as
saxon.

I added -t -replay:1000 to both executions (as Michael suggested, see
below) and got the
same result for the solution provided by Martin Honnen and your xsl:key
solution:
*** Average execution time over 1000 runs: 2ms

Probably this is to be expected since the underlying algorithm is the same
for
both apporaches (iterate over input and process those elements of the
current
"block"), there is just the difference on how the elements in current
"block" are
determined.
I doubt that bigger input files/bigger block sizes will show significant
differences
since the input/output processing will dominate the block determination
time ...


I also converted my recursive func:function() recursive EXSLT solution to
xsl:function XSLT 2.0 and got this worse result:
*** Average execution time over 1000 runs: 3ms


[stammw@br8ggx73 Erwan]$ java -jar saxon9he.jar -t -xsl:part.xsl
-s:data.xml -versionmsg:off
Saxon-HE 9.2.0.3J from Saxonica
Java version 1.6.0
Stylesheet compilation time: 537 milliseconds
Processing file:/Erwan/data.xml
Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/Erwan/data.xml using class
net.sf.saxon.tinytree.TinyBuilder
Tree built in 22 milliseconds
Tree size: 30 nodes, 16 characters, 0 attributes
Loading net.sf.saxon.event.MessageEmitter
<?xml version="1.0" encoding="UTF-8"?>
<r>
   <c>
      <b>11</b>
      <b>12</b>
      <b>13</b>
   </c>
   <c>
      <b>14</b>
      <b>15</b>
      <b>16</b>
   </c>
   <c>
      <b>17</b>
      <b>18</b>
   </c>
</r>Execution time: 63 milliseconds
Memory used: 4562936
NamePool contents: 15 entries in 15 chains. 6 prefixes, 6 URIs
[stammw@br8ggx73 Erwan]$ java -jar saxon9he.jar -t -xsl:ent2.xsl -s:ent.xml
-versionmsg:off
Saxon-HE 9.2.0.3J from Saxonica
Java version 1.6.0
Stylesheet compilation time: 513 milliseconds
Processing file:/Erwan/ent.xml
Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/Erwan/ent.xml using class
net.sf.saxon.tinytree.TinyBuilder
Tree built in 18 milliseconds
Tree size: 41 nodes, 13 characters, 0 attributes
Loading net.sf.saxon.event.MessageEmitter


<all><arguments><argument>1</argument><argument>2</argument><argument>3</argu
ment></arguments><arguments><argument>4</argument><argument>5</argument><argu
ment>6</argument></arguments><arguments><argument>7</argument><argument>8</ar
gument><argument>9</argument></arguments><arguments><argument>10</argument><a
rgument>11</argument></arguments></all>
Execution time: 54 milliseconds
Memory used: 4621896
NamePool contents: 13 entries in 13 chains. 6 prefixes, 6 URIs
[stammw@br8ggx73 Erwan]$



Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
Fixpack team lead
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



From:       Erwan AMOUREUX <erwan.amoureux@xxxxxxxxxxxxxxxxxxxxxxx>
To:         xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Date:       10/21/2010 11:35 AM
Subject:    Re:  question on EXSLT data partitioning



I had a good look at my xslt sheet and , i only use position in match key
or with other context in use.
Sorry for that, my only excuse it's a very bad cold...

But could you test that, please ?

My xml example
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="D:\Mes documents\testxml
\positioncle.xslt"?>
<a>
 <b>11</b>
 <b>12</b>
 <b>13</b>
 <b>14</b>
 <b>15</b>
 <b>16</b>
 <b>17</b>
 <b>18</b>
</a>


My XSLT example

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
 <xsl:key name="part" match="b[(position() - 1) mod 3!=0]" use="generate-id
(../b[(position() - 1) mod 3=0  and ((following-sibling::b)[position
()&lt;3])[generate-id(.)=generate-id(current())]])"/>
 <xsl:template match="/">
  <r>
   <xsl:for-each select="*/b[(position() - 1) mod 3=0]">
    <c>
     <xsl:apply-templates select=".|key('part',generate-id(.))"/>
    </c>
   </xsl:for-each>
  </r>
 </xsl:template>
 <xsl:template match="b">
  <xsl:copy-of select="."/>
 </xsl:template>
</xsl:stylesheet>

I think it's too complicated and maybe it can be false but i'm curious to
know what you think about idea
----- Message d'origine -----
De : "Erwan AMOUREUX" <erwan.amoureux@xxxxxxxxxxxxxxxxxxxxxxx>
@ : <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Envoyi : jeudi 21 octobre 2010 09:36
Objet : Re:  question on EXSLT data partitioning


My mistake!
sorry
----- Message d'origine -----
De : "Michael Kay" <mike@xxxxxxxxxxxx>
@ : <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Envoyi : mercredi 20 octobre 2010 16:24
Objet : Re:  question on EXSLT data partitioning


>
>> For me it's logical
>> When you use global variable, current node is root, so with the
key ,it's the same thing and position is calculated with the root as
initial context
>>
>
> Whether it's logical or not, the specification is quite clear. In XSLT
1.0:
>
> the expression specified in the use attribute of the xsl:key element is
> evaluated with x as the current node and with a node list containing
> just x as the current node list
>
> So position() in the use expression returns 1.
>
> Michael Kay
> Saxonica

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.