|
Subject: [xsl] Is it possible to set the mode dynamically? From: "rus tle profrustyleafiii@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 7 Jan 2020 10:51:00 -0000 |
Is it possible to set the mode dynamically?
The use case:
1. Setting a variable to a file name
<xsl:variable name="PayloadName" select="/POM/Netflix/@payload" />
2. Using that variable to load the file dynamically into another variable
<xsl:variable name="payload" select="document(concat($PayloadName,
'.xml'))/payloadb/>
3. Calling a template and passing the file name as as a param to be used in
that called template as the mode.
<xsl:call-template name="create-html-tables">
<xsl:with-param name="PayloadName" select="$PayloadNameb/>
</xsl:call-template>
<xsl:template name="create-html-tables">
<xsl:param name=bPayloadName"/>
<xsl:apply-templates select="$pom//Event" mode=b$payloadNameb/>
</xsl:template>
Is that a possibility in anyway shape or formb&? Otherwise I am thinking the
only alternative would be to use a choose and then hardcode the mode - which
works, but just wondering if there was a cleaner way?
<xsl:choose>
<xsl:when test="$PayloadName = 'pivot-table-payload'">
<xsl:apply-templates select="$pom//Event" mode="pivot-table"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$pom//Event" mode="default"/>
</xsl:otherwise>
</xsl:choose>
Many thanks,
Rusty
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Merkle Tree Algorithm and, Michael Kay mike@xxx | Thread | Re: [xsl] Is it possible to set the, Martin Honnen martin |
| Re: [xsl] Merkle Tree Algorithm and, Michael Kay mike@xxx | Date | Re: [xsl] Is it possible to set the, Martin Honnen martin |
| Month |