[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Was: mode and moved to Namespaces

Subject: Re: Was: mode and moved to Namespaces
From: Jirka Kosek <jirka@xxxxxxxx>
Date: Tue, 19 Apr 2011 23:16:23 +0200
Re: Was:  mode and moved to Namespaces
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ac wrote:

> The current translation dictionary is setup somewhat like:
> ...
> <word en:title="Mr" f-en:title="Mrs" fr:title="M." f-fr:title="Mme" ... />
> <word en:noun="chair" fr:noun="chaise" ... />
> ...
> 
> all feminine variants can be returned with:
> /dic/word/@*[starts-with(name(.), 'f-')]

Such lookups will tend to be quite slow because matching on name of
element/attribute can't be done using dictionary -- high efficient XSLT
implementations doesn't store element/attributes names for each node,
but they store just number pointing to dictionary with the real
qualified name. This saves memory and makes matching on name very fast.
But if name is not directly present in XPath such fast matching can't be
done.

> all French feminine can be returned with
> /dic/word/@f-fr:*
> all French feminine adjectives can be returned with
> /dic/word/@f-fr:adjective
> all translated English words return form
> /dic/word/@en:*

The trouble with such approach is that you can't change language during
the runtime. You have to pregenerate all queries before running
transformation or use dynamic XPath evaluation (which is not part of
XSLT standard yet).

> all English nouns, whatever gender, can be obtained with something like
> /dic/word/@*:nouns[contains(name(), 'en:')]

If you are using namespaces then this code is not correct. You should
match on namespace name not actual prefix used. So query should be more
like:

/dic/word/@*:nouns[namespace-uri() = 'whatever URI was assigned to en']

> It must be good to know what is right from what is wrong,
> especially with an absolute perspective.
> I have to admit that I have always had some disbelief about absolute
> beliefs,
> but I will keep an open mind, at least just in case.

I consider myself very open-minded. Your usage for namespaces in this
particular case surely works for you, but it's misuse of namespaces.
They were not designed for this and their usage for this several
engineering flaws.

- --
- ------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@xxxxxxxx      http://xmlguru.cz
- ------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
- ------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
- ------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2t+6cACgkQzwmSw7n0dR4F/ACfRIwtkthd9SXVzk4fV+iKoHoe
XbkAnR6T4sWLdIzdyi/+J9gjIr/V8jEd
=1Loa
-----END PGP SIGNATURE-----

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.