473,657 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi,

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

<xsl:styleshe et xmlns:xsl="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.trans form.Transforme rException:
org.apache.xml. utils.WrappedRu ntimeException: 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 |
-----------------------

Jul 20 '05 #1
2 2308
In article <bq**********@n ews-sop.inria.fr>,
Philippe Poulard <Ph************ ****@SPAMsophia .inria.fr> 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!
Jul 20 '05 #2
Richard Tobin wrote:
In article <bq**********@n ews-sop.inria.fr>,
Philippe Poulard <Ph************ ****@SPAMsophia .inria.fr> 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:styleshe et ...>
<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 |
-----------------------

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4250
by: Christian Roth | last post by:
Hello, when using this "identity" processing sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="iso-8859-1" /> <xsl:template match="@*|node()">
1
1539
by: Ken Philips | last post by:
If I want to use featurwes of Xslt Spec 2.0: Do I have to use an extension of .xslt2 or can use .xslt as well? Ken
0
1375
by: luc wastiaux | last post by:
Hello, an acquaintance recently asked me whether there existed web-design tools (like macromedia dreamweaver) that produced XML and XSLT code as their output. I answered that I didn't think such a tool existed since it would have to understand the structure of the data you type in and make some choices that only humans are known to make. Maybe a tool like XMLspy can assist in creating an XSLT stylesheet once you have your XML data ready...
5
4408
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from which it generates the various XSLs). We have considered instead using InfoPath, which is WYSIWYG,...
0
994
by: Nithya Sampathkumar | last post by:
Hi, We are planning what features /improvements need to go in the next release for XSLT. We are making these decisions based on customer input and feedback. So I would like to hear your views on what you would like to see in the release of XSLT. We are evaluating XSLT 2.0 -
5
1840
by: Gilgamesh | last post by:
Hi. I'm looking for an easy way to generate, automatically, an XSLT from an XSD, to be applied to a XML file (conforming the previous XSD) and generate an HTML. Many of you will tell me that this is nonsense, but I think it can be done, given the condition that the XML file (as specified in the XSD) always has a root element (although it would be nice if the root element name could be a parameter of the XSLT), and a given hierarchy of...
14
5137
by: Lee | last post by:
I have a xml file, here is sample part: <?xml version="1.0" encoding="UTF-8"?> <ProducsList> <Product id="1"> <SpecList> <Spec> <SpecLabel>Height</SpecLabel> <SpecValue>10</SpecValue> <SpecCat>Dimension</SpecCat> </Spec>
5
3721
by: Lee | last post by:
I have a xml file, here is sample part: <?xml version="1.0" encoding="UTF-8"?> <ProducsList> <Product id="1"> <SpecList> <Spec> <SpecLabel>Height</SpecLabel> <SpecValue>10</SpecValue> <SpecCat>Dimension</SpecCat> </Spec>
12
2370
by: Stu | last post by:
Being a newbie with XSLT transformation code please excuse my neivte. In addition, I am not sure what I want to do can be done with xslt so I apologize up front for asking anything stupid I have a shell script that needs to get values from an XML file. What I want to do is transform the XML into something more KSH friendly so it can be easy to parsed in my KSH script. I would like to go through an entire XML document and for every...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8603
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.