Ari,
I am new to XSL, so there may be better ways,
but I would put the "year" and "owner" template matches in, but leave
them empty as below,
<xsl:template match="vehicles">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="vehicle">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="make">
<b><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match="model">
<i><xsl:apply-templates/></i>
</xsl:template>
<xsl:template match="year"></xsl:template>
<xsl:template match="owner"></xsl:template>
>Ari wrote to ask why this XML/XSl combination didn't ony output the
make and model:
>
><vehicles>
> <vehicle>
> <make>Mazda</make>
> <model>Miata</model>
> <year>1990</year>
> <owner>
>
> <e-mail>ari@xxxxxxx</e-mail>
> </owner>
> </vehicle>
> <vehicle>
> <make>Porsche</make>
> <model>Boxster</model>
> <year>1998</year>
> <owner>
> <name>Svetlana Soboleva</name>
> </owner>
> </vehicle>
></vehicles>
>
>=================================================================
>== stylesheet
>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
><xsl:template match="make">
> <b><xsl:apply-templates/></b>
></xsl:template>
>
><xsl:template match="model">
> <i><xsl:apply-templates/></i>
></xsl:template>
>
></xsl:stylesheet>
>
>=================================================================
>== result
>
><b>Mazda</b>
><i>Miata</i>
>1990
> Konstantin Krupnikov
> ari@xxxxxxx
><b>Porsche</b>
><i>Boxster</i>
>1998
> Svetlana Soboleva
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|