xsl-list
[Top] [All Lists]

Re: [xsl] How to generate an xmlns attribute with a prefix

2009-08-06 15:00:16

Michael,

thanks: it works indeed.

Marc



----- Original Message ----
From: Michael Kay <mike(_at_)saxonica(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Thursday, August 6, 2009 8:39:33 PM
Subject: RE: [xsl] How to generate an xmlns attribute with a prefix


The important thing to remember is that if you get the element and attribute
names right, the namespace declarations will look after themselves (or
rather, the XSLT processor will look after them).

So to generate an xsi:schemaLocation attribute you do this:

<xsl:attribute name="xsi:schemaLocation"
namespace="http://www.w3.org/2001/XMLSchema-instance";>...</xsl:attribute>

and the xmlns:xsi declaration will appear automatically.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



-----Original Message-----
From: Marc Van Limberghen [mailto:marc2jogger(_at_)yahoo(_dot_)com] 
Sent: 06 August 2009 19:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How to generate an xmlns attribute with a prefix


Hello,
I am transforming with XSL a source XML to a target XML. I 
can design the source XML myself. I can not decide on the 
structure of the target XML.
The target XML must have as its root element the following 
piece of XML:
<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.springframework.org/schema/bean
s 
http://www.springframework.org/schema/beans/spring-beans-2.5.x
sd" default-lazy-init="true">

I could obtain the xmlns attribute in my target XML, by 
putting it in the <xsl:stylesheet> element.
But I do not find a way to generate either the xmlns:xsi and 
xsi:schemaLocation attributes.
I read a lot of FAQs on namespaces and prefixes but could not 
find an answer.

I use:
XML version 1.0
XSLT Stylesheet version 1.0
Xalan XSLT processor Xalan-Java v 2.7.1 (but I donot use 
Java, I use XSL)

All help is much appreciated!
Marc


      

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>