Subject: Re: [xsl] XML-to-XML recursive template handling From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 09 Dec 2011 11:33:57 -0500 |
<xsl:template match="fn-group"> <xsl:param name="node"><xsl:apply-templates/></xsl:param> <!-- A parameter is declared and the results of applying templates to the children of the fn-group are bound to it. (Why a parameter? is this ever overridden from elsewhere?) -->
<!-- Next, we copy the fn-group if it has fn children, and inside, we process the fn children --> <xsl:if test="fn"> <fn-group> <xsl:for-each select="fn"> <!-- code elided here. Each fn is either copied, or it isn't --> </xsl:for-each> </fn-group>
<!-- next we call the emptyfn template, passing $node in --> <xsl:call-template name="emptyfn"> <xsl:with-param name="node" select="$node"/> </xsl:call-template> </xsl:if> </xsl:template>
<xsl:template name="emptyfn"> <!-- but 'emptyfn' is a no-op. If $node tests true, it ... does nothing --> <xsl:param name="node"/> <xsl:if test="not($node)"/> </xsl:template>
<xsl:template match="fn-group"> <xsl:variable name="fn-results"> ... for-each logic goes here ... or do the same thing, more gracefully, with templates ... </xsl:variable> <xsl:if test="normalize-space($fn-results"> <fn-group> <xsl:copy-of select="fn-results"/> </fn-group> </xsl:if> </xsl:template>
Cheers, Wendell
-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML-to-XML recursive template, Lynn Murdock | Thread | [xsl] XML-to-XML recursive template, Lynn Murdock |
RE: [xsl] Translating the new lines, Soyer, Muhammed A. | Date | RE: [xsl] xslt transformation did n, Roelof Wobben |
Month |