This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to output a xmlns:prefix attribute (special case)


This will allow you to put the xmlns:prefix attribute
in SAXON

<xsl:attribute name="prefix:blah"
namespace="URI">blah</xsl:attribute>

However, you will be left with this:

xmlns:prefix="URI" prefix:blah="blah"

So, if you can live with the blah, this is the way to
go.  Otherwise switch to Xalan, and you can just do a

<xsl:attribute name="xmlns:prefix"
namespace="">URI</xsl:attribute>

Note:  Xalan does not conform to the XSLT standard in
this aspect.

--- Richard Gruet <rgruet@intraware.com> wrote:
> Hi all,
> 
> I'm trying to generate a XML-Schema from a
> definition in a custom
> language of my own (itself validated by an
> XML-Schema), using an XSLT
> stylesheet.
> Because my language allows some kind of "imports"
> that will be
> translated to xsd:import elements + xmlns:prefix
> attributes in the
> generated schema, I need to add the xmlns:prefix
> declarations to the
> output xsd:schema element.
> 
> Unfortunately, as I am generating xml (not mere
> text), the XSLT
> processor (Saxon 6.4, but it is probably a general
> rule) prevents me to
> do this, by forbidding to add this particular
> attribute. Instead, it
> detects output elements or attributes whose names
> are qualified with a
> prefix, and inserts automatically the corresponding
> xmlns:prefix
> declarations in the output top element.
> 
> But it does not work for me, since the references to
> the qualified types
> occur only as *values* of an attribute, not directly
> as element or
> attribute names, e.g in:
> 
> <xsd:complexType name="prefix:typeName">
> 
> ..in that case, the XSLT processor does not know
> that it should include
> a xmlns:prefix declaration in my top xsd:schema
> element, and anyway it
> would not know where to take the URI for that
> namespace (I won't declare
> *every* possible namespace on the planet in my
> stylesheet ;-).
> 
> So I'm stuck: the processor prevents me to put
> explicitely xmlns
> declarations, but OTOH does not do it by itself, so
> what to do ?
> Should I switch to text output mode to bypass the
> controls ? Is there a
> clevier way to proceed ?
> 
> Thanks for any advice,
> 
> Richard Gruet
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]