This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: templates matches ... ?


On Wed, 30 Jan 2002 17:34:06 +0100, you wrote:

>Hello,
>
>I've something like :
> 
><xsl:template match="xml.fre.FREKernelKernel.FREGeneralDocument">
>    .... a lot of lines in here ....
></xsl:template>
><xsl:template match="xml.fre.FREKernelKernel.FREDocument">
>    .... exactly the same as above..... a.lot of lines in here ....
></xsl:template>
>
>I can't imagine that this is the way it should be written ?

If you want the same substitution for two different elements then you
can either write:

<xsl:template match="x | y">
    ....
</xsl:template>

or, if one version is not quite the same as the other give one
template a name:

<xsl:template match="x" name="common">
  <!-- matches x's, and can also be called from another template by
name -->
   ...
</xsl:template>

<xsl:template match="y">
   ... this bit only for y's
   <xsl:call-template name="common" />
      <!-- here its the same as an 'x' -->
   ... more stuff for just y's
</xsl:template>

Your element names do not look right either.  Apart from the fact that
all names beginning with xml (in any mix of case) are reserved, you
need to read about either patterns or namespaces or both - I'm not
sure which.  

Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@melvaig.co.uk

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]