Subject: Re: [xsl] inheritance From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 11 Apr 2003 10:22:25 +0100 |
Hi Florian, > im wondering if its possible to do some kind of inheritance with > xslt. I think that the easiest way to achieve the kind of thing that you're after is to have common templates for the common elements, such as: <xsl:template match="property[@name = 'name']"> ... </xsl:template> <xsl:template match="property[@name = 'color']"> ... </xsl:template> And then in the templates for <vehicle> and <car> elements just apply templates to the children: <xsl:template match="vehicle | car"> <xsl:apply-templates /> </xsl:template> The common templates for the name and color properties will be picked up for both vehicles and cars. To get the box around the <details>, you can use a template that matches the <details> element: <xsl:template match="details"> <div class="box"> <xsl:apply-templates /> </div> </xsl:template> This way, you get inheritance from the fact that the same properties in each are handled by the same templates. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] inheritance, florian | Thread | [xsl] Re: inheritance, Dimitre Novatchev |
RE: [xsl] nodes having same values , Jarno . Elovirta | Date | [xsl] Re: XSL-List Digest V4 #1219, Kathrin Compostella |
Month |