El mar, 27-09-2005 a las 11:39 +0100, Ross Gardler escribió:
> HANAX wrote:
> > Now more details:
>
> Can you provide even more details in the form of a path against SVN,
> attach it to an issue in Jira and I'll try and have a look at what is
> going on soon.
>
> >>WARNING:
> >>Further you have to consider that
> >><xsl:template name="voice-markup-head">
> >> <xsl:apply-templates select="//document"/>
> >></xsl:template>
> >>will match *any* occurrence of the document element - even if they
> >>included by another nugget-contract.
> >
> >
> > Now I really don't understand... If I use <xsl:apply-templates
> > select="//document"/>, I need to process all document nodes. I expected
> > that I'm working with xdoc source document, didn't I? So I thought taht
> > every contract has as it's input same xdoc... I thought that I finally have
> > idea how contracts works but seems that I haven't :(
>
> I think you do "have it", it's just that Thorsten has introduced another
> layer of complexity above, so you only "have" part of it ;-)
Hmm, I do not see the complexity. ;-)
in voice.fv:
<forrest:contract name="voice-markup">
<forrest:properties contract="voice-markup">
<forrest:property name="voice-markup" nugget="get.body">
<url>#{$cocoon/parameters/getRequest}.mxml</url>
</forrest:property>
</forrest:properties>
</forrest:contract>
in voice-markup.ft
<xsl:template name="voice-markup-head">
<xsl:param name="voice-markup"/>
<xsl:copy-of select="$voice-markup"/>
</xsl:template>
OR:
See the attached patch. It is basically the same only that the contract
is now doing exactly what the xsl before does.
Either way the *real* problem that you have is that the last pipe in
views is stripping the namespaces which prevent that the content of the
voice markup is rendered correctly. I did not had time (and will not in
the near future) to fix the strip_namespaces.xsl to let the voice ns
through. Sorry. For your development comment it out and build views
again.
HTH
--
thorsten
"Together we stand, divided we fall!"
Hey you (Pink Floyd)
Index: src/documentation/content/xdocs/voice.fv
===================================================================
--- src/documentation/content/xdocs/voice.fv (revisión: 291373)
+++ src/documentation/content/xdocs/voice.fv (copia de trabajo)
@@ -19,7 +19,13 @@
<forrest:views xmlns:forrest="http://apache.org/forrest/templates/1.0">
<forrest:view type="xhtml">
<forrest:css url="default.css"/>
- <forrest:contract name="voice-markup"/>
+ <forrest:contract name="voice-markup">
+ <forrest:properties contract="voice-markup">
+ <forrest:property name="voice-markup" nugget="get.body">
+ <url>#{$cocoon/parameters/getRequest}.source.rewritten.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
<forrest:contract name="siteinfo-meta">
<forrest:properties contract="siteinfo-meta">
<forrest:property name="siteinfo-meta" nugget="get.build.info">
@@ -38,31 +44,83 @@
</forrest:contract>
</forrest:hook>
<forrest:hook name="nav-main-hook">
- <!--forrest:contract name="nav-main"/-->
- <!--<forrest:contract name="nav-main-sub"/>-->
+ <!-- <forrest:contract name="nav-main">
+ <forrest:properties contract="nav-main">
+ <forrest:property name="nav-main" nugget="get.navigation">
+ <url>${cocoon.parameters.getRequest}.navigation.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
+ <forrest:contract name="nav-main-sub">
+ <forrest:properties contract="nav-main-sub">
+ <forrest:property name="nav-main-sub" nugget="get.navigation">
+ <url>#{$cocoon/parameters/getRequest}.navigation.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>-->
</forrest:hook>
</forrest:hook>
<forrest:hook name="page">
<forrest:hook name="leftbar">
- <forrest:contract name="nav-section"/>
- <forrest:contract name="search-input"/>
+ <!-- <forrest:contract name="nav-section">
+ <forrest:properties contract="nav-section">
+ <forrest:property name="nav-section" nugget="get.navigation">
+ <url>#{$cocoon/parameters/getRequest}.navigation.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
+ <forrest:contract name="search-input">
+ <forrest:properties contract="search-input">
+ <forrest:property name="search-input">
+ <search name="MyProject" domain="mydomain" provider="google"/>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>-->
</forrest:hook>
<!-- You can group elements to a template and call it from any view.
- e.g.
- <forrest:hook name="export-link">
- <forrest:contract name="content-txt-link"/>
- <forrest:contract name="content-pdf-link"/>
- </forrest:hook>
- can be called as <forrest:call-template name="export-link"/>
- when saved as {project:resources}/templates/export-link.vt.xml
+ e.g.
+ <forrest:hook name="export-link">
+ <forrest:contract name="content-txt-link"/>
+ <forrest:contract name="content-pdf-link"/>
+ </forrest:hook>
+ can be called as <forrest:call-template name="export-link"/>
+ when saved as {project:resources}/templates/export-link.vt.xml
<forrest:call-template name="export-link"/>
- -->
+ -->
<forrest:hook name="content">
- <forrest:contract name="content-title"/>
- <forrest:contract name="content-minitoc"/>
- <forrest:contract name="content-main"/>
+ <!-- < r291360
+ <forrest:contract name="content-title"/>-->
+ <forrest:contract name="content-title">
+ <forrest:properties contract="content-title">
+ <forrest:property name="content-title" nugget="get.body">
+ <url>#{$cocoon/parameters/getRequest}.body.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
+ <!-- < r291360
+ <forrest:contract name="content-minitoc"/>-->
+ <forrest:contract name="content-minitoc">
+ <forrest:properties contract="content-minitoc">
+ <forrest:property name="content-minitoc-toc" nugget="get.toc">
+ <url>#{$cocoon/parameters/getRequest}.toc.xml</url>
+ </forrest:property>
+ <forrest:property name="content-minitoc-conf" >
+ <toc max-depth="2"
+ min-sections="1" location="page"/>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
+ <!-- < r291360
+ <forrest:contract name="content-main"/>-->
+ <forrest:contract name="content-main">
+ <forrest:properties contract="content-main">
+ <forrest:property name="content-main" nugget="get.body">
+ <url>#{$cocoon/parameters/getRequest}.body.xml</url>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
<!--
<forrest:contract name="content-include-html">
<forrest:properties contract="content-include-html">
@@ -83,7 +141,18 @@
</forrest:hook>
</forrest:hook>
<forrest:hook name="footer">
- <forrest:contract name="siteinfo-feedback"/>
+ <!-- < r291360
+ <forrest:contract name="siteinfo-feedback"/>-->
+ <forrest:contract name="siteinfo-feedback">
+ <forrest:properties contract="siteinfo-feedback">
+ <forrest:property name="siteinfo-feedback">
+ <feedback to="[EMAIL PROTECTED]"
+ href="mailto:[EMAIL PROTECTED] " >
+ Send feedback about the website to:
+ </feedback>
+ </forrest:property>
+ </forrest:properties>
+ </forrest:contract>
<forrest:contract name="siteinfo-last-published"/>
</forrest:hook>
</forrest:view>
Index: templates/voice-markup.ft
===================================================================
--- templates/voice-markup.ft (revisión: 291373)
+++ templates/voice-markup.ft (copia de trabajo)
@@ -15,20 +15,124 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<forrest:contract name="voice-markup" type="nugget"
+<forrest:contract name="voice-markup" type="nugget"
xmlns:forrest="http://apache.org/forrest/templates/1.0">
- <description>
- This functions will output the voiceXML markup for the document.
- NOTE: This is a placeholder template only - it is not currently functional.
- </description>
- <usage><![CDATA[<forrest:contract name="voice-markup"/>]]></usage>
- <forrest:template
- xmlns:forrest="http://apache.org/forrest/templates/1.0"
- format="xhtml" name="voice-markup" inputFormat="xsl" body="false" head="true">
- <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template name="voice-markup-head">
- <meta name="voice-generator" content="org.apache.forrest.plugins.output.voice"/>
- </xsl:template>
- </xsl:stylesheet>
- </forrest:template>
-</forrest:contract>
+ <description> This functions will output the voiceXML markup for the
+ document. NOTE: This is a placeholder template only - it is not currently
+ functional. </description>
+ <usage><![CDATA[<forrest:contract name="voice-markup">
+ <forrest:properties contract="voice-markup">
+ <forrest:property name="voice-markup" nugget="get.body">
+ <url>#{$cocoon/parameters/getRequest}.source.rewritten.xml</url>
+ </forrest:property>
+ </forrest:properties>
+</forrest:contract>]]></usage>
+ <forrest:template
+ xmlns:vxml="http://www.w3.org/2001/vxml"
+ xmlns:ev="http://www.w3.org/2001/xml-events"
+ xmlns:xv="http://www.voicexml.org/2002/xhtml+voice" xml:lang="en-US"
+ format="xhtml" name="voice-markup" inputFormat="xsl" body="false"
+ head="true">
+ <xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template name="voice-markup-head">
+ <xsl:param name="voice-markup"/>
+ <meta name="voice-generator"
+ content="org.apache.forrest.plugins.output.voice"/>
+ <xsl:call-template name="voiceNavigation">
+ <xsl:with-param name="root" select="$voice-markup/document/body"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="voiceNavigation">
+ <xsl:param name="root"/>
+ <vxml:form id="main">
+ <vxml:var name="activeSection"/>
+ <vxml:var name="navigateDir"/>
+ <vxml:block>
+ <xsl:for-each select="$root/section[position() > 1]">
+ <vxml:assign expr="true">
+ <xsl:attribute name="name">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </vxml:assign>
+ </xsl:for-each>
+ </vxml:block>
+ <xsl:for-each select="$root/section">
+ <vxml:field>
+ <xsl:attribute name="name">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <vxml:grammar src="simpleNav.jsgf"/>
+ <vxml:prompt timeout="2s"> Section <xsl:value-of
+ select="position()"/>: <xsl:value-of select="title"/>.
+ <vxml:break/> <xsl:apply-templates/> </vxml:prompt>
+ <vxml:filled>
+ <vxml:assign name="activeSection">
+ <xsl:attribute name="expr">
+ <xsl:value-of select="position()"/>
+ </xsl:attribute>
+ </vxml:assign>
+ <vxml:assign name="navigateDir">
+ <xsl:attribute name="expr">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </vxml:assign>
+ <vxml:throw event="navigate.simple"/>
+ </vxml:filled>
+ <vxml:catch event="noinput">
+ <vxml:assign expr="true">
+ <xsl:attribute name="name">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </vxml:assign>
+ <vxml:assign name="activeSection">
+ <xsl:attribute name="expr">
+ <xsl:value-of select="position()"/>
+ </xsl:attribute>
+ </vxml:assign>
+ <vxml:assign name="navigateDir" expr="'next'"/>
+ <vxml:throw event="navigate.simple"/>
+ </vxml:catch>
+ </vxml:field>
+ </xsl:for-each>
+ <vxml:field name="navigate_wait_for_good_index">
+ <vxml:grammar type="application/srgs"> #ABNF 1.0; language en-us;
+ mode voice; root $command; private $number = 1<xsl:for-each
+ select="$root/section[position() > 1]"> | <xsl:value-of
+ select="position()+1"/></xsl:for-each>; public $command = $number
+ {$ = $$}; </vxml:grammar>
+ <vxml:prompt timeout="5s"> Say correct section index. </vxml:prompt>
+ <vxml:filled>
+ <vxml:assign name="navigateDir"
+ expr="navigate_wait_for_good_index"/>
+ <vxml:throw event="navigate.simple"/>
+ </vxml:filled>
+ <vxml:catch event="help nomatch noinput" count="1"> You can say
+ index from 1 to <xsl:value-of select="count($root/section)"/>
+ </vxml:catch>
+ <vxml:catch event="help nomatch noinput" count="2"/>
+ </vxml:field>
+ <vxml:catch event="navigate.simple">
+ <vxml:if cond="navigateDir == 'next'">
+ <vxml:assign name="activeSection" expr="activeSection + 1"/>
+ <vxml:elseif cond="navigateDir == 'back'"/>
+ <vxml:assign name="activeSection" expr="activeSection - 1"/>
+ <vxml:else/>
+ <vxml:assign name="activeSection" expr="navigateDir"/>
+ </vxml:if>
+ <vxml:if> <xsl:attribute name="cond">activeSection <= 0 ||
+ activeSection ><xsl:value-of
+ select="count($root/section)"/></xsl:attribute> Index <vxml:value
+ expr="activeSection"/> is out of range. <vxml:clear
+ namelist="navigate_wait_for_good_index"/> <xsl:for-each
+ select="$root/section"> <vxml:elseif> <xsl:attribute
+ name="cond">activeSection == <xsl:value-of
+ select="position()"/></xsl:attribute> </vxml:elseif> <vxml:clear>
+ <xsl:attribute name="namelist"> <xsl:value-of select="@id"/>
+ </xsl:attribute> </vxml:clear> </xsl:for-each> </vxml:if>
+ </vxml:catch>
+ </vxml:form>
+ </xsl:template>
+ </xsl:stylesheet>
+ </forrest:template>
+</forrest:contract>
\ No newline at end of file