XSLT <xsl:apply-templates> एलीमेंट

<xsl:apply-templates> एलीमेंट एक टैम्पलेट को वर्तमान एलीमेंट या वर्तमान एलीमेंट के सब-एलीमेंटों पर लगा सकता है。

<xsl:apply-templates> एलीमेंट

<xsl:apply-templates> एलीमेंट एक टैम्पलेट को वर्तमान एलीमेंट या वर्तमान एलीमेंट के सब-एलीमेंटों पर लगा सकता है。

यदि हम <xsl:apply-templates> एलीमेंट में एक select गुण जोड़ें, तो इस एलीमेंट केवल उन सही सब-एलीमेंटों को संसाधित करेगा जो गुण के मापदण्ड के अनुसार हों। हम गुण का उपयोग कर सकते हैं ताकि उसके सब-एलीमेंटों को संसाधित करने की क्रमवारी को निर्धारित करें。

नीचे देखें XSL स्टाइल शीट:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2> 
<xsl:apply-templates/> 
</body>
</html>
</xsl:template>
<xsl:template match="cd">
<p>
<xsl:apply-templates select="title"/> 
<xsl:apply-templates select="artist"/>
</p>
</xsl:template>
<xsl:template match="title">
शीर्षक: <span style="color:#ff0000">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
<xsl:template match="artist">
Artist: <span style="color:#00ff00">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
</xsl:stylesheet>

इस XML फ़ाइल को देखेंइस XSL फ़ाइल को देखेंपरिणाम देखें