अगर मैं एक टेम्पलेट के रूप में इस प्रकार है, जो एक बटन बनाने के लिए प्रयोग किया जाता है है:XSLT: अन्य टेम्पलेट में स्थित खाके का पुन: उपयोग कैसे
<xsl:template match="button" name="button">
<a class="button" href="{@href}">
<xsl:value-of select="@name"/>
</a>
</xsl:template>
मैं की तरह एक और टेम्पलेट में है कि बटन का उपयोग करने में सक्षम होना चाहता हूँ यह:
<xsl:template match="createForm">
...
<button name="Create" href="/create"/>
</xsl:template>
हालांकि, यह केवल बटन टैग को आउटपुट करेगा। मैं मौजूदा बटन टेम्पलेट के माध्यम से संसाधित करना चाहता हूं। यह कैसे हासिल किया जा सकता है?
-
धन्यवाद आपका जवाब के लिए डेविड एम।
<xsl:template match="button" name="button">
<xsl:param name="name" select="@name"/>
<xsl:param name="href" select="@href"/>
<a class="button" href="{$href}">
<xsl:value-of select="$name"/>
</a>
</xsl:template>
createForm टेम्पलेट अब इस तरह दिखता है:
<xsl:template match="createForm">
...
<xsl:call-template name="button">
<xsl:with-param name="name" select="'Create'"/>
</xsl:call-template>
</xsl:template>
इस के शीर्षक के बारे में निश्चित नहीं है ... समझाने की देखभाल? – Noldorin
हाँ यह वास्तव में एक उपयुक्त शीर्षक नहीं है। एक शीर्षक के बारे में सोच नहीं सका। सुझाव? – Joel