xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Neary <Da...@phenix.fr>
Subject RE: Variable Template Name
Date Mon, 05 May 2003 14:51:36 GMT

> De : Elmar.Hurni@agi.ch [mailto:Elmar.Hurni@agi.ch]
> But i have a new problem.
> Does someone know a solution?

I have had the same problem, and I have solved it in a slightly different
way.

> Problem:
> 	
> 	<xsl:variable name="templateName">objectives</xsl:variable>
> 
> 	<xsl:call-template name="$templateName"/>
> The variable "templateName" is a Value, wich is read from a XML.
> The $templateName in call-template does not dissolve.

Yup - this is because the argument to call-template is a QName, that is, the
name of a tag, rather than an XPath expression. 

In my problem, the solution was rather simple. I had something like this in
the xml...

<root>
  <node mode="mode1">
  <node mode="mode2">
  <node mode="mode1">
  <node mode="mode3">
  <node mode="mode4">
</root>

And I ended up just doing this...

<xsl:template match="/">
  <xsl:apply-templates select="root/node"/>
</xsl:template>

<xsl:template match="node[@mode='mode1']">
  Mode 1
</xsl:template>

<xsl:template match="node[@mode='mode2']">
  Mode 2
</xsl:template>

<xsl:template match="node[@mode='mode3']">
  Mode 3
</xsl:template>

<xsl:template match="node[@mode='mode4']">
  Mode 4
</xsl:template>

I'm assuming that you can in some way modify your xml to use attributes
rather than parameters to get to the right template.


Hope this helps,
Dave.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Mime
View raw message