Passing Location Paths With Predicates As Template Parameter

m3m00oo

New Member
\[code\]<xsl:template match="foobar"> <xsl:if test="a[name = 'foo']"> <xsl:apply-templates select="x/y[1]|x/y[2]" /> </xsl:if> <xsl:if test="a[name = 'bar']"> <xsl:apply-templates select="x/y[3]|x/y[4]|x/y[5]" /> </xsl:if></xsl:template>\[/code\]I would like to pass the location path expressions "x/y[1]|x/y[2]" and x/y[3]|x/y[4]|x/y[5] as parameter because this values may change in the future and I don't want to edit the template but only the parameter definition. I would like to use the template above as\[code\]<xsl:template match="foobar"> <xsl:if test="a[name = 'foo']"> <xsl:apply-templates select="$param1" /> </xsl:if> <xsl:if test="a[name = 'bar']"> <xsl:apply-templates select="$param2" /> </xsl:if></xsl:template>\[/code\]As far as I know this is not possible. What is the best way to externalize the location path expressions?Many thanks in advance
 
Back
Top