Caching xsl:key with document Source

Discussion in 'XML' started by Darren Gilroy, Sep 26, 2003.

  1. I was wondering if there was a way to cache a built xsl:key?

    I have a custom resolver that returns a DOM when
    "document('Assets.xml')" is requested, but the stylesheet takes some
    amount of time to generate the key. If we could cache the built key
    (along with the DOM?) then we would be one step ahead. I'm using
    Xalan 2.5.1.

    Note the key is built on the document referenced by the document()
    call, NOT the main source document.

    I have a stylesheet similar to the following:

    <xsl:stylesheet>
    <xsl:key name="kAssetById" match="Asset" use="id"/>

    <xsl:variable name="assetDoc" select="document('Assets.xml')/Assets"/>

    <xsl:template match="Fragment">
    <xsl:variable name="assetId" select="@parentAssetId">
    <xsl:for-each select="$assetDoc">
    <xsl:apply-templates select="key( 'kAssetById', $assetId )">
    </xsl:for-each>
    </xsl:template>
    <xsl:template match="Asset">
    [some pretty output]
    </xsl:template>
    </xsl:stylesheet>

    and the input:

    <Page>
    <Fragment parentAssetId="abc"/>
    <Fragment parentAssetId="def"/>
    <Fragment parentAssetId="ghi"/>
    <Fragment parentAssetId="jkl"/>
    </Page>

    Thanks,
    Darren
     
    Darren Gilroy, Sep 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mads Orbesen Troest
    Replies:
    2
    Views:
    831
    Mads Orbesen Troest
    Apr 20, 2004
  2. Replies:
    1
    Views:
    3,688
    A. Bolmarcich
    May 27, 2005
  3. =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

    Help with XSL/XSL:FO for producing revision indicator bar in document.

    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=, Apr 28, 2006, in forum: XML
    Replies:
    6
    Views:
    589
    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
    May 3, 2006
  4. Replies:
    2
    Views:
    9,354
    Martin Honnen
    Sep 5, 2006
  5. M P
    Replies:
    1
    Views:
    547
Loading...

Share This Page