Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > [XSLT] Is this a bug ( in the spec / in the tool ) ?

Reply
Thread Tools

[XSLT] Is this a bug ( in the spec / in the tool ) ?

 
 
Philippe Poulard
Guest
Posts: n/a
 
      12-03-2003
Hi,

I need to define inside my stylesheet some xml structured datas, like
this (this example works) :

<xsl:stylesheet xmlnssl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:data="*** Datas ***"
exclude-result-prefixes="data">

<data:foo bar="data"/>

<xsl:template match="/">
<!-- XSLT stuff here -->
<xsl:template>

</xsl:stylesheet>

unfortunately, the content of my data structure contains values with
brackets and dollars, like this :

<data:foo bar="{$data}"/>

when i create the template, i catch the following exception :
javax.xml.transform.TransformerException:
org.apache.xml.utils.WrappedRuntimeException: Could not find variable
with the name of data

because the xslt unmarshaler think that it is an attribute value
template; however, it is not, because present outside any context
handable by some xslt features such as output production or variable
computation; it is only valid xml data, and i want to retrieve this data
as it is written !

it is not clear in the spec that such a particular case should not be
evaluate as an AVT (if anybody knows, tell me)
i don't think it have to, because this part of the document is not for
the xslt processor, and can't be handled by it (i think); escaping with
{{ and }} has sense only for real AVT and would corrupt my datas, so it
is not acceptable

the only way to avoid this is to declare a variable of that name in the
scope of the data, like this :

<xsl:variable name="data"/>
<data:foo bar="{$data}"/>

baaah ! i don't want to declare false variables for my thousand datas
i really think it's a bug

do you think there is a lack in the spec ?
do you think this is a bug in apache ?
--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------

 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      12-03-2003
In article <bql9na$43r$(E-Mail Removed)>,
Philippe Poulard <(E-Mail Removed)> wrote:

><data:foo bar="{$data}"/>


The processor is right to interpret this as an attribute value
template; indeed the spec gives it as an example: "such as an
attribute of a literal result element". It's just the sort of thing
that attribute value templates are meant for.

You could write it as <data:foo bar="{'{$data}'}"/>

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
 
Reply With Quote
 
 
 
 
Philippe Poulard
Guest
Posts: n/a
 
      12-04-2003
Richard Tobin wrote:
> In article <bql9na$43r$(E-Mail Removed)>,
> Philippe Poulard <(E-Mail Removed)> wrote:
>
>
>><data:foo bar="{$data}"/>

>
>
> The processor is right to interpret this as an attribute value
> template; indeed the spec gives it as an example: "such as an
> attribute of a literal result element". It's just the sort of thing
> that attribute value templates are meant for.
>
> You could write it as <data:foo bar="{'{$data}'}"/>
>
> -- Richard


the example i described before is erroneous (in fact, there is a little
difference with the real case i encountered); i read again the spec and
made some other tests;

in fact, the problem i described cause no error because it is said that
"not all attributes are interpreted as attribute value
templates.../...attributes of top-level elements (.../...) are not
interpreted as attribute value templates"

so, the example above works perfectly because <data:foo bar="{$data}"/>
is one of the top level elements

the processor is strictly conformant to the spec, because the following
case :
<xsl:stylesheet ...>
<data:foos>
<data:foo bar="{$data}"/>
</data:foos>
...
</xsl:stylesheet>
causes an error, and that's my really problem

however, i really think it shouldn't be interpreted as avt, because the
purpose of the avt is to perform computation on literal result element;
in my case, it is not literal result element because this xml structure
is out of the scope of the processor : "an XSLT processor (.../...) must
ignore a top-level element without giving an error if it does not
recognize the namespace URI"; it is obvious that subelements should also
be ignored because the processor can't handle the result in any way, and
if i use the document('') function, i need to retrive the value {$data},
not the value {'{$data}'}
--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rake spec:rcov => [BUG] Segmentation fault ruby 1.8.6 (2007-09-24)[i386-mswin32] scott Ruby 5 10-05-2008 03:19 PM
How to control order of spec execution in "spec specs/* " ? Andrew Chen Ruby 1 03-25-2008 12:36 PM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
need recommendations on what brand, specific computer tool kit to buy (physical tool kits, not software kits/suites) Trevor Smithson Computer Support 5 05-25-2005 07:48 PM
If aboutEach URI is absolute? (spec bug?) Victor Porton XML 0 06-01-2004 02:29 PM



Advertisments