私は XSLT に非常に慣れていません。テンプレート内から呼び出し元のテンプレートの名前を取得する方法があるかどうか疑問に思っていました。
現在、少し複雑な構造で次のものを取得しています。1 つのテンプレートが 1 回直接含まれ、別のテンプレートを介して 1 回含まれます。特定のテンプレートから呼び出された場合にのみ、このテンプレートに新しいタグを追加する必要があります。
<xsl:element name="parent">
<xsl:choose>
<xsl:when test="$myVariable = 'process1'">
<xsl:call-template name="templateA"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="templateB"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<xsl:template name="templateA">
<!-- Some Other Tags Here -->
<xsl:call-template name="templateB />"
</xsl:template>
<xsl:template name="templateb"> <!-- very big template -->
<!-- existing tags here -->
<!-- Add a new tag here only if called via templateA -->
</xsl:template>
明確にするために、
ご覧のとおり、templateBはどちらの方法でもインクルードされますが、templateAはいくつかのタグを追加してからtemplateBをインクルードします。
templateAから呼び出された場合にのみ、新しいタグをtemplateBに追加したいと考えています。することは可能ですか?