xsl-list
[Top] [All Lists]

Re: [xsl] adding namespace node to arbitrary <xsl:element> - xslt 1 or 2

2007-05-16 15:47:57


The result document is read by another java program (created by an external
party), and a certain section/fragment of the result document is read as an
independent xml file, hence the term 'inline'.

of course that means the software's behaviour doesn't conform with the
xml XML namespace rec or the Xpath data model, which says that repeating
the namespace declaration  within the same scope has no effect. Not that
it is unique in not conforming, it joins a large company, including of
course any validating XML parser...

If you _only_ need the declarations on the oai_dc element then it's
easy, just make sure that the declarations are not used on the outer
elements (by making sure that they are not in scope in part of the
stylesheet that generates them). You can probably ensure that the
namespace declarations are not used above oai_dc at the very least by
using different prefixes. If you need to use to same namespace, with the
same prefix, both on oa_dc and one of its ancesters then you are doomed
to failure using XSLT1, and you'll have to post process the file with
sed or perl or something and add the declarations back. If you are
prepared to use XSLT2 and (more dangerously) XML 1.1, an alternative
plan would be to undeclare all the prefixes on teh parent element of
oai_dc, so then the serialiser will automatically declare them all again
on oai_dc.  Note however a prefix undeclaration is a syntax error to a
XML Namespace 1.0 system (that is, most XML parsers around).

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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--