You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Robert S. Koberg" <ro...@koberg.com> on 2002/03/07 15:35:37 UTC

XSLTC and keys and optimizations

Hi,

XSLTC
---------------
If using XSLTC, it's current state, should you avoid using xsl:key? I 
noticed bug reports about it. Is it even worth it to use keys in XSLTC?
========================================================

Xalan optimizations
----------------
Scott Boag mentioned some optimaztions he was working on making 
expensive xsl ( like //*[@id=$id] ) as fast as keying it. I was 
wondering if this would also have the same effect on XML brought in 
through the document function ( document('my.xml')//*[@id=$id]) )?

best,
-Rob


Re: XSLTC and keys and optimizations

Posted by "Robert S. Koberg" <ro...@koberg.com>.
Hi,

Tom Amiro wrote:
> Hi Robert,
> 
> Check out
> 
>   http://xml.apache.org/xalan-j/xsltc/xsltc_performance.html
> 
> That may give you some insight.
> 


Yes, but not exactly. I currently use ALOT of keys (VERY common in 
XSLT). The results Jacek posted on cocoon-dev have made me want to look 
at switching to XSLTC

Can you suggest the best way to handle a situation I have? The XML 
structure is a hierarchical representation of a site. There are folders 
and pages. An XML content piece can be assigned at the folder level to 
cascade down to all pages in the folder or a content piece can be 
assigned at the page level. The content pieces just have IDs pointing to 
a node in a separate 'content.xml' config document [XML below] so the 
pieces can be reused easily.

Say I want to find the active page nodeset and put it in a variable. Is 
this the best way to identify a page with XSLTC?

<xsl:variable
    name="active_nodeset"
    select="//page[@id=$id]"/>

I find the page, then I need to find the representation in content.xml 
[below]. Is this the best way?

<xsl:variable
    name="xml_nodeset"
    select="document('content.xml')//xml[@id=$active_nodeset/@id]"/>

thanks,
-Rob
---------------------------------------------------------------------
Stripped down example:
--- site.xml ----
<config>
    <folder id="f0000000001">
       <col type="narrow_left"/>
       <col type="wide_center"/>
       <col type="narrow_right"/>
       <page id="p0000000001">
          <col type="narrow_left"/>
          <col type="wide_center">
             <xml id="index_en.xml"/>
          </col>
          <col type="narrow_right"/>
       </page>
       <folder id="f742372637">
         <col type="narrow_left"/>
         <col type="wide_center"/>
         <col type="narrow_right">
            <xml id="c242640179.xml"/>
         </col>
	<page id="p268675785">
            <col type="narrow_left"/>
            <col type="wide_center">
               <xml id="c1602691198.xml"/>
            </col>
            <col type="narrow_right"/>
         </page>
         <folder id="f28737725">
            <col type="narrow_left"/>
            <col type="wide_center"/>			
            <col type="narrow_right"/>
            <page id="p1284141096">
               <col type="narrow_left"/>
               <col type="wide_center"/>
               <col type="narrow_right"/>
            </page>
          </folder>
       </folder>
    </folder>
</config>
=================================
--- content.xml ---
<config>
    <content id="f0000000001" owner="rk123">
       <xml label="Main Home page" id="index_en.xml" owner="default"/>
       <content id="f742372637" owner="rk123">
          <xml label="boop" id="c1602691198.xml" owner="default"/>
          <xml label="hjhjhjhjh" id="c242640179.xml" owner="default"/>
	 <content id="f28737725" owner="rk123">
             <xml label="scoobie" id="c366915042.xml" owner="default"/>
          </content>
        </content>
    </content>
</config>


Re: XSLTC and keys and optimizations

Posted by Tom Amiro <To...@Sun.COM>.
Hi Robert,

Check out

  http://xml.apache.org/xalan-j/xsltc/xsltc_performance.html

That may give you some insight.

Tom
 
"Robert S. Koberg" wrote:
> 
> Hi,
> 
> XSLTC
> ---------------
> If using XSLTC, it's current state, should you avoid using xsl:key? I
> noticed bug reports about it. Is it even worth it to use keys in XSLTC?
> ========================================================
> 
> Xalan optimizations
> ----------------
> Scott Boag mentioned some optimaztions he was working on making
> expensive xsl ( like //*[@id=$id] ) as fast as keying it. I was
> wondering if this would also have the same effect on XML brought in
> through the document function ( document('my.xml')//*[@id=$id]) )?
> 
> best,
> -Rob

-- 
 Tom Amiro -- SQA Engineer
 Sun XML Technology Development
 voice: 781-442-0589 Fax: 781-442-1437
 eMail: tom.amiro@.sun.com