You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by HANAX <ha...@centrum.sk> on 2005/07/28 12:53:20 UTC
different templates for same element
While rendering voice output, I think that should be goof to render some simple visual output, for example section titles as <H1> and so on...
I have something like
<xsl:template match="body">
<xsl:call-template name="voiceNavigation"/>
<xsl:call-template name="visualRender"/>
</xsl:template>
in "voiceNavigation" I have somthing like
<xsl:for-each select="//section">
...
<xsl:apply-templates/>
...
</xsl:for-each>
And having templates like
<xsl:template match="p">
<xsl:value-of select="."/>
<vxml:break/>
</xsl:template>
<xsl:template match="title">
Title: <xsl:value-of select="."/>.
<vxml:break/>
</xsl:template>
I should do the same in "visualRender".
But if I call apply-templates, the "p" template will be applied, but I want to render only text not <vxml:break/> and for example for title I want something like:
<xsl:template match="title">
<h1>
<xsl:value-of select="."/>
</h1>
</xsl:template>
Any solution?
Re: different templates for same element
Posted by Ross Gardler <rg...@apache.org>.
HANAX wrote:
> While rendering voice output, I think that should be goof to render some simple visual output, for example section titles as <H1> and so on...
> I have something like
>
> <xsl:template match="body">
> <xsl:call-template name="voiceNavigation"/>
> <xsl:call-template name="visualRender"/>
> </xsl:template>
>
>
> in "voiceNavigation" I have somthing like
>
> <xsl:for-each select="//section">
> ...
> <xsl:apply-templates/>
> ...
> </xsl:for-each>
>
>
> And having templates like
> <xsl:template match="p">
> <xsl:value-of select="."/>
> <vxml:break/>
> </xsl:template>
>
> <xsl:template match="title">
> Title: <xsl:value-of select="."/>.
> <vxml:break/>
> </xsl:template>
>
> I should do the same in "visualRender".
> But if I call apply-templates, the "p" template will be applied, but I want to render only text not <vxml:break/> and for example for title I want something like:
>
> <xsl:template match="title">
> <h1>
> <xsl:value-of select="."/>
> </h1>
> </xsl:template>
>
>
> Any solution?
You want to be able to reuse the existing visual navigation stuff rather
than rewrite it. This means it is time to start considering moving your
code into a forrest:views. In order for us to understand how to do this
we really need to see the full code and understand exactly how the
voiceNavigation stuff works.
Perhaps it is time for you to upload what you have,a s you have
suggested in another thread.
Ross