Changeset 5238


Ignore:
Timestamp:
05/19/14 21:36:17 (10 years ago)
Author:
xnrn@gmx.net
Message:

added template: cmd:cache-profile to prefetch the profile into the cache on the fly. the profile (if freshly fetched) will however only be available in subsequent calls

Location:
CMDI-Interoperability/CMD2RDF/trunk/xsl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMDI-Interoperability/CMD2RDF/trunk/xsl/CMD2RDFcache.xsl

    r5233 r5238  
    2323            <xsl:with-param name="id" select="$id" />
    2424            <xsl:with-param name="key" select="'profiles'" />
     25            <xsl:with-param name="cache" select="'use'" />
    2526        </xsl:call-template>
    2627    </xsl:function>
    2728
    2829
     30    <xsl:template name="cmd:cache-profile">
     31        <xsl:param name="id"/>
     32        <!--        <xsl:sequence select="doc(cmd:ppath($id,'xml'))"/>-->
     33        <xsl:message>getting from cache via function</xsl:message>
     34        <xsl:call-template name="getData">
     35            <xsl:with-param name="id" select="$id" />
     36            <xsl:with-param name="key" select="'profiles'" />
     37            <xsl:with-param name="cache" select="'refresh'" />
     38        </xsl:call-template>
     39    </xsl:template>
     40   
     41   
     42
    2943</xsl:stylesheet>
  • CMDI-Interoperability/CMD2RDF/trunk/xsl/CMDRecord2RDFcache.xsl

    r5233 r5238  
    2929   
    3030   
     31    <xsl:template match="/cmd:CMD/cmd:Components">
     32        <!-- get the profile id -->
     33        <!-- and ignore if there are multiple MdProfile and just take the first!!
     34                        although probably this more a case for the schema validation!  -->
     35        <xsl:variable name="id" select="(/cmd:CMD/cmd:Header/cmd:MdProfile)[1]"/>
     36        <!-- prefetch the profile into the cache on the fly.
     37            the profile (if freshly fetched)  will however only be available in subsequent calls
     38            one can't write to output, while in temporary tree (e.g. xsl:variable, or a function),
     39            therefore this has to be called separately in the main sequence
     40            this call does not return any data -->
     41        <xsl:call-template name="cmd:cache-profile">
     42            <xsl:with-param name="id" select="$id"></xsl:with-param>
     43        </xsl:call-template>
     44        <!-- load the profile -->
     45        <xsl:variable name="profile" select="cmd:profile($id)"/>
     46        <!-- the base URL (the namespace in RDF/XML) of the RDF resources will change during traversal to the URL of the active profile/component -->
     47        <xsl:variable name="ns" select="concat(cmd:ppath($id,'rdf'),'#')"/>
     48        <!-- we traverse the profile/component scheme and find the matching instances -->
     49        <xsl:apply-templates select="$profile/CMD_ComponentSpec/CMD_Component">
     50            <xsl:with-param name="context" tunnel="yes" select="''"/>
     51            <xsl:with-param name="ns" tunnel="yes" select="$ns"/>
     52            <xsl:with-param name="instance" tunnel="yes" select="."/>
     53        </xsl:apply-templates>
     54    </xsl:template>
     55   
     56   
    3157</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.