You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joel McConaughy <jo...@displayware.com> on 2004/06/06 20:07:48 UTC
[cforms] How to add tag attributes that contain ?
I want to create anchor tags in my form template that contain widget
values like the following:
<a href="nextpage?id=/<ft:widget id='uid'/>/" />
This produces the following error:
The value of attribute "href" associated with an element type "a" must
not contain the '<' character
Is there a way to do this within the template itself of do I need to add
an xslt transform and use <xsl:attribute>?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [cforms] How to add tag attributes that contain ?
Posted by Marc Portier <mp...@outerthought.org>.
Joel McConaughy wrote:
> I want to create anchor tags in my form template that contain widget
> values like the following:
>
> <a href="nextpage?id=/<ft:widget id='uid'/>/" />
>
> This produces the following error:
>
> The value of attribute "href" associated with an element type "a" must
> not contain the '<' character
>
indeed, the result of what you typed doesn't pass the xml wellformedness
test
> Is there a way to do this within the template itself of do I need to add
> an xslt transform and use <xsl:attribute>?
>
'fraid so.
here is what i recently did for showing a mail-address value as a
mailto: -link
in the template: you add
<ft:widget id="email"><fi:styling type="email" /></ft:widget>
plus you provide your own field-styling xslt that
1/ inherits from the existing styling by importing
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
exclude-result-prefixes="fi">
<xsl:import
href="context://samples/blocks/forms/resources/forms-advanced-field-styling.xsl"
/>
and
2/ provide custom styling for these email-output styles
<!--
| this adds a fi:styling type="email" to widgets of type output
| it will produce a mailto: href around them
-->
<xsl:template match="fi:output[fi:styling/@type='email']">
<a href="mailto:{./fi:value}"><xsl:value-of select="./fi:value"/></a>
</xsl:template>
(notice: the above uses the {} shorthand notation over the more puristic
<xsl:attribute> but it pretty much boils down to the same thing
HTH,
-marc=
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
mpo@outerthought.org mpo@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org