Subject: RE: apply-templates with-param failed
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 27 Sep 2005 09:14:23 +0100
|
You haven't shown us the source document. Perhaps its outermost element
isn't called BugCollection, or perhaps it's in a namespace.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Xiaocun Xu [mailto:xiaocunxu@xxxxxxxxx]
> Sent: 27 September 2005 02:08
> To: xsl-list
> Subject: apply-templates with-param failed
>
> Hi,
>
> I am working on splitting a FindBugs result XML into
> multiple XMLs by finding keywords in Class/@classname.
> Keywords for all functional areas are defined in
> FunctionalAreaDef.xml:
> <Application>
> <FunctionalArea name="message">
> <Keywords>
> <Keyword>notification</Keyword>
> <Keyword>message</Keyword>
> </Keywords>
> </FunctionalArea> ...
> </Application>
>
> I use the following XSL to read FunctionalAreaDef.xml,
> loop through each FunctionalArea element, create an
> output file using the FunctioalArea/@name and pass
> Keywords to BugCollection element(in the source
> FindBugs XML):
> <xsl:variable name="vFunctionalArea"
> select="document('FunctionalAreaDef.xml')"/>
> <xsl:template match="/">
> <xsl:for-each
> select="$vFunctionalArea/Application/FunctionalArea">
> <xsl:call-template name="splitByFunctionalAreas">
> <xsl:with-param name="pFunctionalAreaDef"
> select="."/>
> </xsl:call-template>
> </xsl:for-each>
> </xsl:template>
> <xsl:template name="splitByFunctionalAreas">
> <xsl:param name="pFunctionalAreaDef" select="."/>
> <xsl:variable name="vFileName"
> select="$pFunctionalAreaDef/@name"/>
> <xsl:result-document href="{$vFileName}_bugs.xml">
> <xsl:apply-templates select="BugCollection">
> <xsl:with-param name="pKeywords"
> select="$pFunctionalAreaDef/Keywords"/>
> </xsl:apply-templates>
> </xsl:result-document>
> </xsl:template>
> <xsl:template match="BugCollection">
> <xsl:param name="pKeywords" select="."/>
> <xsl:value-of select="$pKeywords"/>
> ...
>
> Somehow the BugCollection template did not get evoked
> as <xsl:value-of select="$pKeywords"/> seems not
> evaluated (the output file is empty with just a XML
> header). I used matching mode as well, still no luck.
> Any suggestion on what have I done wrong would be
> much appreciated.
>
> thanks,
> Xiaocun
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
|