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

Re: asthetics vs convention for namespace prefixs

Subject: Re: asthetics vs convention for namespace prefixs
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 26 Jul 2007 14:31:54 +0100
Re:  asthetics vs convention for namespace prefixs
> I know I can't rely on the prefix being used,

actually you can, in XSLT2. the data model is quite explict that (a) the
prefix is stored in the model as part of the QName  (this part was also
essentially true but worded differently in XSLt1) and (b) an XSLT/XQuery
serialiser will not change the prefix, (Of course if the in-memory tree
is passed to some other system and only later serialised, then that
serialisation won't necessarily follow XSLt rules, and XSLT1 allowed an
XSLT system a lot more flexibility)

> but is it frowned upon to try and encourage a specific namespace
> prefix?

some people frown upon it, but they alos frown upon the use of prefixes
in attribute or element content as well.

If for example yu are generating XSLt (or schematron, or XSD schema or
...) that has something like select="x:foo/x:bar" then ensuring that an
ancestor element declares the appropriate namespace with exactly the
desired prefix "x" is an absolute requirement not just a question of
asthetics. 


Incidentally if you put
xmlns:xyz="http://schema.example.org/XYZ/Publishing" up at the top of
your stylesheet on xsl:stylesheet element you can write

     <xsl:element name="xyz:{local-name(.)}"
          namespace="http://schema.example.org/XYZ/Publishing"
          xmlns:xyz="http://schema.example.org/XYZ/Publishing">
          <xsl:copy-of select="@*" />

as

     <xsl:element name="xyz:{local-name(.)}"
          <xsl:copy-of select="@*" />

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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.