xsl-list
[Top] [All Lists]

RE: use-when attribute?

2004-12-18 06:13:27
Is there some elegant way to use the correct xpath expression 
depending 
on the input document?

An "if then else" works if there's only two options, but I'll 
have more 
than that.

I suppose one obvious approach would be this ...

      <xsl:variable name="citerefs" select="//db:biblioref/@linkend |
                                                              
      //cite:biblioref/@cite:key |
                                                              
      //tei:cit/@href"/>



I would be inclined to do it with template rules:

<xsl:template match="db:biblioref">
  <xsl:apply-templates select="@linkend" mode="z"/>
</xsl:template>

<xsl:template match="cite:biblioref">
  <xsl:apply-templates select="@cite:key" mode="z"/>
</xsl:template>

<xsl:template match="@*" mode="z">
  ...
</xsl:template>

etc.

But perhaps I haven't understood the problem.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>