Apply XSLT for selected element

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharadwajrv
    New Member
    • May 2007
    • 26

    Apply XSLT for selected element

    I have a XML file with 350+ elements in it and i need to apply XSLT to format 3 elements in it and the output XML should have all the element (from the original) and the 3 elements formatted.

    i'm unable to understand how to do this. please can you help me.

    Cheer
    Venu
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Start with a copy template:
    [code=xml]
    <xsl:template match="*">
    <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>
    [/code]

    Create a template for each of your 3 elements that you need changed.
    [code=xml]
    <xsl:template match="element1 ">
    <xsl:copy>
    apply some extra formatting?
    </xsl:copy>
    </xsl:template>
    <xsl:template match="element2 ">
    etc..
    </xsl:template>
    <xsl:template match="element3 ">
    etc..
    </xsl:template>
    [/code]

    Comment

    Working...