You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by Matt Sergeant <ma...@sergeant.org> on 2003/07/09 09:20:21 UTC

Proposal: XSP attribute interpolation

At the moment I often end up typing very verbose XSP pages to get 
attributes in elements containing expressions. Here's an example from 
some recent code:

     if (my $n = $page->previous_page) {
         <pagenav previous="1">
             <xsp:attribute
                 name="page"><xsp:expr>$n</xsp:expr></xsp:attribute>
             &lt;&lt;
         </pagenav>
     }

I think we should take a leaf out of XSLT's book and allow 
interpolation in attributes, so that this would work:

     if (my $n = $page->previous_page) {
         <pagenav previous="1" page="{$n}">&lt;&lt;</pagenav>
     }

Should be fairly simple to do. Thoughts?

Matt.


Re: [PATCH] Re: Proposal: XSP attribute interpolation

Posted by Jörg Walter <jw...@garni.ch>.
Am Wednesday, 09. July 2003 16:49, schrieb Matt Sergeant:
> On Wed, 9 Jul 2003, Matt Sergeant wrote:
> > I think we should take a leaf out of XSLT's book and allow
> > interpolation in attributes, so that this would work:
> >
> >      if (my $n = $page->previous_page) {
> >          <pagenav previous="1" page="{$n}">&lt;&lt;</pagenav>
> >      }
>
> Patch to implement this attached. Shall I apply it?

Looks fine. Please ;-)

-- 
CU
   Joerg

[PATCH] Re: Proposal: XSP attribute interpolation

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 9 Jul 2003, Matt Sergeant wrote:

> I think we should take a leaf out of XSLT's book and allow
> interpolation in attributes, so that this would work:
>
>      if (my $n = $page->previous_page) {
>          <pagenav previous="1" page="{$n}">&lt;&lt;</pagenav>
>      }

Patch to implement this attached. Shall I apply it?

-- 
<!-- Matt -->
<:->get a SMart net</:->
Spam trap - do not mail: spam-sig@spamtrap.messagelabs.com

Re: Proposal: XSP attribute interpolation

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 9 Jul 2003, Kip Hampton wrote:

> Robin Berjon wrote:
>
>
> >
> > They don't care about being compatible with us. In fact, just because
> > it's suggested by one of us and not one of them they'll reject it as
> > "dirty". I'd say don't bother wasting your patience on them.
>
> You may be right, but that doesn't mean we shouldn't try. If they're
> wrong for being dismissive and unilateral then we'd be wrong to follow suit.
>
> I'm +1 on the ATV in XSP, but we really should give our fellow ASFians
> the benefit of the doubt and discuss it in public. The XSP "spec" was
> theirs originally, after all...

A good voice of reason. I've now posted to both xsp-dev and cocoon-dev. I
got one enthusiastic private response from the xsp-dev posting. Nothing so
far (and I don't expect to given prior response rates) on cocoon-dev.

-- 
<!-- Matt -->
<:->get a SMart net</:->
Spam trap - do not mail: spam-sig@spamtrap.messagelabs.com

Re: Proposal: XSP attribute interpolation

Posted by Kip Hampton <kh...@totalcinema.com>.
Robin Berjon wrote:


> 
> They don't care about being compatible with us. In fact, just because 
> it's suggested by one of us and not one of them they'll reject it as 
> "dirty". I'd say don't bother wasting your patience on them.

You may be right, but that doesn't mean we shouldn't try. If they're 
wrong for being dismissive and unilateral then we'd be wrong to follow suit.

I'm +1 on the ATV in XSP, but we really should give our fellow ASFians 
the benefit of the doubt and discuss it in public. The XSP "spec" was 
theirs originally, after all...

-kip, wandering dowstairs, still sad that there are no other dev-dahuts 
here in PDX...


Re: Proposal: XSP attribute interpolation

Posted by Robin Berjon <ro...@knowscape.com>.
Matt Sergeant wrote:
> Yes, using the exact same rules as XSLT would be good here (although I 
> hear the spec isn't entirely clear in this section).

I find it clear. Basically escaping a { or } is done by doubling it. The same 
rules apply as what normally does for \.

I'm not sure about having {} in the embedded Perl though. I guess if it's 
balanced its fine.

> We should probably communicate this issue to the Cocoon folks though.

They don't care about being compatible with us. In fact, just because it's 
suggested by one of us and not one of them they'll reject it as "dirty". I'd say 
don't bother wasting your patience on them.

--r



Re: Proposal: XSP attribute interpolation

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wednesday, Jul 9, 2003, at 08:36 Europe/London, Jörg Walter wrote:

>> I think we should take a leaf out of XSLT's book and allow
>> interpolation in attributes, so that this would work:
>>
>>      if (my $n = $page->previous_page) {
>>          <pagenav previous="1" page="{$n}">&lt;&lt;</pagenav>
>>      }
>>
>> Should be fairly simple to do. Thoughts?
>
> Yes please! I've been longing for that for quite some time now. So we 
> scrap
> that Cocoon compatibility now? Fine by me... :-)
> Attribute value templates will be made exactly as in XSLT, I assume?
> (regarding quoting of {}'s, multiple {...}'s in one attribute and the 
> like)

Yes, using the exact same rules as XSLT would be good here (although I 
hear the spec isn't entirely clear in this section).

We should probably communicate this issue to the Cocoon folks though.

Matt.


Re: Proposal: XSP attribute interpolation

Posted by Jörg Walter <jw...@garni.ch>.
Am Wednesday, 09. July 2003 09:20, schrieb Matt Sergeant:
> At the moment I often end up typing very verbose XSP pages to get
> attributes in elements containing expressions. Here's an example from
> some recent code:
>
>      if (my $n = $page->previous_page) {
>          <pagenav previous="1">
>              <xsp:attribute
>                  name="page"><xsp:expr>$n</xsp:expr></xsp:attribute>
>              &lt;&lt;
>          </pagenav>
>      }
>
> I think we should take a leaf out of XSLT's book and allow
> interpolation in attributes, so that this would work:
>
>      if (my $n = $page->previous_page) {
>          <pagenav previous="1" page="{$n}">&lt;&lt;</pagenav>
>      }
>
> Should be fairly simple to do. Thoughts?

Yes please! I've been longing for that for quite some time now. So we scrap 
that Cocoon compatibility now? Fine by me... :-)
Attribute value templates will be made exactly as in XSLT, I assume? 
(regarding quoting of {}'s, multiple {...}'s in one attribute and the like)

-- 
CU
   Joerg