RE: namespaces in x:parse

2002-11-14 Thread Shawn Bayern
On Thu, 14 Nov 2002 [EMAIL PROTECTED] wrote:

  x:registerNamespace prefix=xsl uri
  =http://www.w3.org/1999/XSL/Transform; scope=.../
   !-- registerNamespace tag is NOT defined in the JSTL1.0
 specification !!! --
 
 following name might look more familiar to anybody; no explanation needed.
 
  x:xmlns prefix=... uri=... scope=.../

Names that begin with xml are reserved by the XML specification.

-- 
Shawn Bayern
JSTL in Action   http://www.manning.com/bayern


--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org




RE: namespaces in x:parse

2002-11-14 Thread matsuhashi

Names that begin with xml are reserved by the XML specification.

Yes, you are right. I was stupid, sorry...




--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org




RE: namespaces in x:parse

2002-11-14 Thread Gisella Saavedra
In case somebody is interested in the resolution for
parsing xml obviating the namespace,  I got the value of the
select attributes by the following piece of code:

x:set var=lightColor scope=application
  select=string($colorsXml//*[name = 'light']/*[local-name() = 'select']) /

-Original Message-
From: Gisella Saavedra 
Sent: Wednesday, November 13, 2002 3:36 PM
To: 'Tag Libraries Users List'
Subject: namespaces in x:parse


Hello,

can anyone offer any help on what follows:

I have the following file, colors.xsl, which I read as xml input although it is a 
stylesheet:

xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:variable name=dark select='#99'ciao/xsl:variable
xsl:variable name=medium select='#B3B697'hola/xsl:variable
xsl:variable name=light select='#EDEBEB'/   
/xsl:stylesheet

I basically need to set background colors for a JSP-based application.
What I do is to set application variables containing the color values.  
This file is read once, at application login.

I have the following piece of code WHICH WORKS when I remove the namespace
prefixes from colors.xsl:

c:import var=colors url=/mwr/colors.xsl/
x:parse xml=${colors} var=colorsXml/
x:set var=mediumColor scope=application
  select=string($colorsXml//stylesheet/variable[name='medium']/select) /
...


Does somebody know how I can handle the namespace prefix xls in the
select attribute of x:set?  
I tried:
x:set var=darkColor scope=application
  select=string($colorsXml//*[local-name() = 'dark']/select) /

but it does not retrieve anything
??

Gisella


--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org




Re: namespaces in x:parse

2002-11-13 Thread matsuhashi

Hi,

In the last Oct - Nov time, I posted an issue to this Taglib User List,
which is very similar to your problem. The title of my initial post was
Does JSTL XML taglibs ignore XMLNamespace of input document?(later I
found this title was incorrect, not forcusing my problem precisely) dated
at 09 Oct 2002.

Shawn Bayern kindly responded to my post which was followed by several
e-mail exchanges between Shawn and me. Unfortunately you can not see them
at the Taglib User List archieve at
http://www.mail-archive.com/taglibs-user;jakarta.apache.org/ for some
reason (may be due to my mistake). If you require I can send the record to
you.

The simple answer I got from Shawn Bayarn was that, as far as JSTL1.0
specification tells, you can NOT use the namespace prefixes in XPath
expressions in x:... select=xpath. If you want to process an input XML
document with explicit Namespaces (in other word, qualified elements), you
need to explicitly use the local-name() function and namespace-uri()
function, or name() function defined by XPath1.0 specification to make your
XPath well-matching against the input document.

The way you can do in JSTL1.0 would be to write something like:

  x:set var=mediumColor scope=application
 select=string($colorsXml//stylesheet[namespace-uri()
=http://www.w3.org/1999/XSL/Transform]/variable[namespace-uri()
=http://www.w3.org/1999/XSL/Transform and @name='medium']/@select) /

(sorry, I did not check if this code runs properly for you. I meant to show
you how to use the namespace-url() function to make the XPath valid without
using namespace prefixes ...).

Shawn's JSTL Action book has a section where he explained what you can
and cannot do in XPath expression in the JSTL1.0 way. In there you would
find more precise explanation than my (may be inaccurate) note.

--

When I got to know that I can not use XML Namespace prefixes in XPath
expression in x:... tags and therefore the XPath expressions tend to be
very long and hard-to-read/write, I wanted to find out if there is any
possibility for JSTL1.0 specification betterment. So I did a quick hack
(modify taglib implementation to allow namespace prefixes in xpath). I
reached a conclusion that a specification betterment seems to be possible.

At the end of discussion, Shawn mentioned an idea of introducing a new tag
by which you can register combinations of Namespace prefix and URI which to
be reffered from the XPath expressions within x:... select=xpath tags.
Consider that new tag is introduced, your code could look something like:

c:import var=colors url=/mwr/colors.xsl/
x:parse xml=${colors} var=colorsXml/
x:registerNamespace prefix=xsl uri
=http://www.w3.org/1999/XSL/Transform; scope=.../
  !-- registerNamespace tag is NOT defined in the JSTL1.0
specification !!! --
x:set var=mediumColor scope=application
  select=string($colorsXml//xsl:stylesheet/xsl:variable[@name
='medium']/@select) /
...

This code looks short, much readable, quite in synch with the XSLT way of
using XPath!
Don't you think so?



 MATSUHASHI,kazuaki (FAMILY,given)
 QUICK Corp
 Japan
 [EMAIL PROTECTED]




--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org




RE: namespaces in x:parse

2002-11-13 Thread Gisella Saavedra
thanks a lot Pierre and arigato, Matsuhashi-san
for the answers!!

It's been very helpful.  Yes, I also wish, like many of us, that these needed
changes in XPath and JSTL will be available soon,

Gisella

-Original Message-
From: [EMAIL PROTECTED] [mailto:matsuhashi;quick.co.jp]
Sent: Wednesday, November 13, 2002 6:04 PM
To: Tag Libraries Users List
Subject: Re: namespaces in x:parse



Hi,

In the last Oct - Nov time, I posted an issue to this Taglib User List,
which is very similar to your problem. The title of my initial post was
Does JSTL XML taglibs ignore XMLNamespace of input document?(later I
found this title was incorrect, not forcusing my problem precisely) dated
at 09 Oct 2002.

Shawn Bayern kindly responded to my post which was followed by several
e-mail exchanges between Shawn and me. Unfortunately you can not see them
at the Taglib User List archieve at
http://www.mail-archive.com/taglibs-user;jakarta.apache.org/ for some
reason (may be due to my mistake). If you require I can send the record to
you.

The simple answer I got from Shawn Bayarn was that, as far as JSTL1.0
specification tells, you can NOT use the namespace prefixes in XPath
expressions in x:... select=xpath. If you want to process an input XML
document with explicit Namespaces (in other word, qualified elements), you
need to explicitly use the local-name() function and namespace-uri()
function, or name() function defined by XPath1.0 specification to make your
XPath well-matching against the input document.

The way you can do in JSTL1.0 would be to write something like:

  x:set var=mediumColor scope=application
 select=string($colorsXml//stylesheet[namespace-uri()
=http://www.w3.org/1999/XSL/Transform]/variable[namespace-uri()
=http://www.w3.org/1999/XSL/Transform and @name='medium']/@select) /

(sorry, I did not check if this code runs properly for you. I meant to show
you how to use the namespace-url() function to make the XPath valid without
using namespace prefixes ...).

Shawn's JSTL Action book has a section where he explained what you can
and cannot do in XPath expression in the JSTL1.0 way. In there you would
find more precise explanation than my (may be inaccurate) note.

--

When I got to know that I can not use XML Namespace prefixes in XPath
expression in x:... tags and therefore the XPath expressions tend to be
very long and hard-to-read/write, I wanted to find out if there is any
possibility for JSTL1.0 specification betterment. So I did a quick hack
(modify taglib implementation to allow namespace prefixes in xpath). I
reached a conclusion that a specification betterment seems to be possible.

At the end of discussion, Shawn mentioned an idea of introducing a new tag
by which you can register combinations of Namespace prefix and URI which to
be reffered from the XPath expressions within x:... select=xpath tags.
Consider that new tag is introduced, your code could look something like:

c:import var=colors url=/mwr/colors.xsl/
x:parse xml=${colors} var=colorsXml/
x:registerNamespace prefix=xsl uri
=http://www.w3.org/1999/XSL/Transform; scope=.../
  !-- registerNamespace tag is NOT defined in the JSTL1.0
specification !!! --
x:set var=mediumColor scope=application
  select=string($colorsXml//xsl:stylesheet/xsl:variable[@name
='medium']/@select) /
...

This code looks short, much readable, quite in synch with the XSLT way of
using XPath!
Don't you think so?



 MATSUHASHI,kazuaki (FAMILY,given)
 QUICK Corp
 Japan
 [EMAIL PROTECTED]




--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org


--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org




RE: namespaces in x:parse

2002-11-13 Thread matsuhashi

Rather than this

 x:registerNamespace prefix=xsl uri
 =http://www.w3.org/1999/XSL/Transform; scope=.../
  !-- registerNamespace tag is NOT defined in the JSTL1.0
specification !!! --

following name might look more familiar to anybody; no explanation needed.

 x:xmlns prefix=... uri=... scope=.../


 MATSUHASHI,kazuaki
 QUICK Corp
 Japan





--
To unsubscribe, e-mail:   mailto:taglibs-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org