Subject: RE: [xsl] Namespace problem, part two From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx> Date: Sat, 26 Sep 2009 02:12:40 +1200 |
Hi Ken Although the comments are slightly different both yourself and Martin suggested the same edit. Unfortunately ---- .. <xsl:element name="{$ln}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:attribute namespace="http://www.w3.org/2001/XMLSchema-instance" name="xsi:noNamespaceSchemaLocation">../../xml_utils/hcdocs.xsd</xsl:attribu te> .. ---- results in no change to my output. The top (first) output document contains <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xml_utils/hcdocs.xsd"> and any other ("included") output documents contain <document xsi:noNamespaceSchemaLocation="../../xml_utils/hcdocs.xsd"> When I attempt to validate the documents (in XMLSpy) the first one is valid, but the other ones report an error Unable to locate a reference to a supported schema type (DTD, W3C Schema) within this document instance. The namespace declaration in <xsl:element..> certainly does have some effect: if I take it out then none of the output documents are valid, with it there at least the first document is. Hoping somebody can see what is going wrong here, Trevor -----Original Message----- From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] Sent: Saturday, 26 September 2009 1:34 a.m. To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Namespace problem, part two At 2009-09-26 01:13 +1200, Trevor Nicholls wrote: >lower-order output documents are missing a namespace node. >... > <xsl:element name="{$ln}" >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> The namespace declaration above has no effect ... namespace declarations in the stylesheet will only add namespace nodes to literal result elements. > <xsl:attribute >name="xsi:noNamespaceSchemaLocation">../../xml_utils/hcdocs.xsd</xsl:attrib u >te> Above you are creating an attribute node out of thin air, but you aren't indicating in what namespace the "xsi:" prefix is in. I would have expected the processor to have given you an error on this. You should have added this to the <xsl:attribute> instruction: namespace="http://www.w3.org/2001/XMLSchema-instance" This tells the processor what you want the prefix of the attribute in the result tree to be bound to. I hope this helps. . . . . . . . . . . . . Ken -- Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes. Interested in other classes? http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Namespace problem, part t, G. Ken Holman | Thread | Re: [xsl] Namespace problem, part t, Martin Honnen |
Re: [xsl] Namespace problem, part t, G. Ken Holman | Date | Re: [xsl] Namespace problem, part t, Martin Honnen |
Month |