diff options
Added "transform_in_context" helper template
* handles inclusion of the meta DOM in the input source of transformations called through that template
** i.e. simplifies transformation chaining
-rw-r--r-- | generate.xsl | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/generate.xsl b/generate.xsl index cba8bea..f307085 100644 --- a/generate.xsl +++ b/generate.xsl @@ -16,26 +16,36 @@ <xsl:include href="utility/transformer.xsl"/> -<xsl:template match="meta"> +<xsl:variable name="context" select="/"/> + +<xsl:template name="transform_in_context"> + <xsl:param name="input"/> + <xsl:param name="transformation"/> + <xsl:call-template name="transformer"> <xsl:with-param name="input"> <data> - <xsl:copy-of select="."/> - <xsl:call-template name="transformer"> - <xsl:with-param name="input"> - <data> - <xsl:copy-of select="."/> - <xsl:call-template name="transformer"> - <xsl:with-param name="input" select="."/> - <xsl:with-param name="transformation">[source.xsl]</xsl:with-param> - </xsl:call-template> - </data> - </xsl:with-param> - <xsl:with-param name="transformation">[datasource.xsl]</xsl:with-param> - </xsl:call-template> + <xsl:copy-of select="$context"/> + <xsl:copy-of select="$input"/> </data> </xsl:with-param> + <xsl:with-param name="transformation" select="$transformation"/> + </xsl:call-template> +</xsl:template> + +<xsl:template match="meta"> + <xsl:call-template name="transform_in_context"> <xsl:with-param name="transformation">[result.xsl]</xsl:with-param> + <xsl:with-param name="input"> + <xsl:call-template name="transform_in_context"> + <xsl:with-param name="transformation">[datasource.xsl]</xsl:with-param> + <xsl:with-param name="input"> + <xsl:call-template name="transform_in_context"> + <xsl:with-param name="transformation">[source.xsl]</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:with-param> </xsl:call-template> </xsl:template> |