[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] RE: result document flush


Subject: [xsl] RE: result document flush
From: Robby Pelssers <Robby.Pelssers@xxxxxxx>
Date: Wed, 18 Jul 2012 00:48:48 +0200

Hi all,

I am running into the same issue as described in this thread:
http://www.biglist.com/lists/xsl-list/archives/200705/msg00045.html

However I can't use the old school grouping technique unfortunately as the
elements don't have the same grouping key.

Already tried to work around it naively by using a function that would
retrieve the key, which didn't seem to work but is that because it just is not
allowed to use a function call in the group-by or because I made a mistake in
my select statement.

<xsl:for-each-group
         select="document(concat($sourceFolder,
@FILENAME))/maximo:*/maximo:*/maximo:*" group-by="znapz:getURI(.)">
    <xsl:apply-templates select="current-group()[1]"/>
</xsl:for-each-group>

Bottom line is,

The other approach described by Abel in the above thread mentions
deduplicating a list of writeable URI's.  How could I incorporate this in
below code?

    <xsl:variable name="uniqueURIs" select="distinct-values(for $element in
document(concat($sourceFolder, @FILENAME))/maximo:*/maximo:*/maximo:* return
znapz:getURI($element))"/>

    <xsl:template match="/">
        <xsl:apply-templates
select="PACKAGEMANIFEST/PREVIEWINFO/PACKAGEFILE"/>
    </xsl:template>

    <xsl:template match="PACKAGEFILE">
        <xsl:apply-templates  select="document(concat($sourceFolder,
@FILENAME))/maximo:*/maximo:*/maximo:*"/>
    </xsl:template>

    <xsl:function name="znapz:getURI" as="xs:anyURI">
        <xsl:param name="element" as="element()"/>
        <xsl:apply-templates select="$element" mode="getURI"/>
    </xsl:function>

    <xsl:template match="maximo:*">
     <!-somehow I would need to  use that sequence of uniqueURI's here but I
can't e.g. remove used ones for checking later on again --?>
        <xsl:result-document method="xml" href="{znapz:getURI(.)}">
            <xsl:element xmlns="http://www.ibm.com/maximo"
name="{../../local-name()}">
                <xsl:apply-templates select="../../@*"/>
                <xsl:element name="{../local-name()}">
                    <xsl:copy-of select="."/>
                </xsl:element>
            </xsl:element>
        </xsl:result-document>
    </xsl:template>


Kind regards,
Robby


Current Thread