What do I need to change in my XSL to achieve the above? I have tried to manually remove xmlns:a... part but the file fails to validate after that. And even though the XSL contains the encoding bit but the XML file fails to get that.
Subject:Duplicate xmlns value and XML header problem Author:Tony Lavinio Date:31 Aug 2005 11:14 PM
The <?xml... encoding=?> in the XSLT file refers to the encoding of the
XSLT file itself, not of its output. Use <xsl:output encoding="utf-8"/>
right inside of your <xsl:stylesheet> directive.
As for getting rid of the duplication between xmlns and xmlns:a, if they
both point to the same namespace, then not only do you have to get rid of
the xmlns:a= attribute, but also anywhere in the document that an element
or attribute is prefixed by a:, you must remove the a: also.
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:05 Sep 2005 07:10 AM
>The <?xml... encoding=?>
>in the XSLT file refers to the
>encoding of the
>XSLT file itself, not of its
>output. Use <xsl:output
>encoding="utf-8"/>
>right inside of your
><xsl:stylesheet>
>directive.
Thanks Tony, I'll use the parameter as suggested.
>As for getting rid of the
>duplication between xmlns and
>xmlns:a, if they
>both point to the same
>namespace, then not only do
>you have to get rid of
>the xmlns:a= attribute, but
>also anywhere in the document
>that an element
>or attribute is prefixed by
>a:, you must remove the a:
>also.
Although they both point to the same schema, the point is that the following line is already present in the source XML file :
<FSAHSFFeedPP xmlns="http://www.fsa.gov.uk/XMLSchema/FSAHSFFeedPP-v1-2">
and the xmlns:a is inserted by Stylus Studio when the stylesheet is created using XSLT Mapper. If I remove it then the stylesheet won't create a valid XML file. Hence my problem still remains. I hope I explained it correctly.
Below is what I would want the above part in output XML file to look like:
Subject:Duplicate xmlns value and XML header problem Author:Tony Lavinio Date:06 Sep 2005 09:43 AM
There isn't enough information in your post to give an answer;
if you could either attach the input .xml and .xslt files here
(using the little "Attach File" checkbox in the reply window),
or email them to stylus-field-report (at) stylusstudio.com, we'd
be happy to take a look for you.
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:06 Sep 2005 10:44 AM
>There isn't enough information
>in your post to give an
>answer;
>if you could either attach the
>input .xml and .xslt files
>here
>(using the little "Attach
>File" checkbox in the reply
>window),
>or email them to
>stylus-field-report (at)
>stylusstudio.com, we'd
>be happy to take a look for
>you.
Thanks Tony. I am attaching the files (source XML and XSLT used to transform it).
Subject:Duplicate xmlns value and XML header problem Author:Tony Lavinio Date:08 Sep 2005 10:19 AM
Okay, I asked the person responsible for this, and his answer is that
there is a problem in the mapper that shows up in your case. That's
the bad news.
The good news is that there is a work-around, and also that someone will
fix this ASAP.
The workaround is to use an instance XML document as a target, instead
of the schema. If you have a sample of what the output should look like,
that will make mapper happy. For some reason, mapper has decided to not
like the namespaces in the schema.
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:09 Sep 2005 05:25 AM
>Okay, I asked the person
>responsible for this, and his
>answer is that
>there is a problem in the
>mapper that shows up in your
>case. That's
>the bad news.
>
>The good news is that there is
>a work-around, and also that
>someone will
>fix this ASAP.
>
>The workaround is to use an
>instance XML document as a
>target, instead
>of the schema. If you have a
>sample of what the output
>should look like,
>that will make mapper happy.
>For some reason, mapper has
>decided to not
>like the namespaces in the
>schema.
Many thanks for looking into the matter, Tony. However I am still having the same problem using the suggested workaround. I am attaching the input, output (used to generate the XSLT) and XSLT file that I used.
...which means that it won't be able to match the source in the value-of it's using.
Creating a mapping from scratch that use the XML source and target you attached, things seem to work OK from what I can understand, even if there is some redundancy in namespace declarations:
<xsl:template match="/">
<a:FSAHSFFeedPP xmlns="http://www.fsa.gov.uk/XMLSchema/FSAHSFFeedPP-v1-2">
<b:FSAFeedHeader xmlns="http://www.fsa.gov.uk/XMLSchema/FSAFeedCommon-v1-2">
<xsl:value-of select="c:FSAHSFFeedRI/c:FSAFeedHeader"/>
<b:FeedTargetSchemaVersion>
<xsl:value-of select="c:FSAHSFFeedRI/c:FSAFeedHeader/c:FeedTargetSchemaVersion"/>
...
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:10 Sep 2005 09:41 AM
>Creating a mapping from
>scratch that use the XML
>source and target you
>attached, things seem to work
>OK from what I can understand,
>even if there is some
>redundancy in namespace
>declarations:
Minollo,
Thanks for replying. You are right that despite the namespace duplication Stylus Studio still produces a valid XML. But that is my point. As we have to adhere to a specification set by a third-party having a duplicate namespace declaration can be a potential problem and that is what I was trying to point to in my posts. From what I understood reading Tony's last post was that he meant using the proposed workaround I'll be able to get rid of the namespace duplication, which didn't work for me. The output XML should look exactly like the output file I have uploaded in my previous post. I am attaching the screenshot of the XSLT Mapper that I have developed to give an idea of what I am doing. Hope that explains it better.
Subject:Duplicate xmlns value and XML header problem Author:Tony Lavinio Date:14 Sep 2005 12:09 PM
The patch 377n will be released on 9/19.
But we are a little confused by something. Any XML-aware application
should treat <peppo xmlns="pippo"/> and <p:peppo xmlns:p="pippo"/>
exactly the same. What prefix is used, or whether it is the default
namespace or an explicit one, shouldn't make any difference to the
consumer. In fact, they aren't supposed to.
So what exactly is wrong in this case, since the forms as far as the
XML infoset are concerned, are identical?
In some cases, due to scoping, the mapper may generate namespace
prefixes where someone coding by hand wouldn't, or vice-versa.
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:16 Sep 2005 05:19 AM Originally Posted: 16 Sep 2005 05:20 AM
>The patch 377n will be
>released on 9/19.
Thanks for the update Tony.
>But we are a little confused
>by something. Any XML-aware
>application
>should treat <peppo
>xmlns="pippo"/> and
><p:peppo
>xmlns:p="pippo"/>
>exactly the same. What prefix
>is used, or whether it is the
>default
>namespace or an explicit one,
>shouldn't make any difference
>to the
>consumer. In fact, they
>aren't supposed to.
>
>So what exactly is wrong in
>this case, since the forms as
>far as the
>XML infoset are concerned, are
>identical?
I tested the files with duplicate namespace with the third-party server and they were accepted without any problems. You are right in saying that technically there shouldn't be a problem. The minor hitch is with the Production Support people in my company who say that the final format of the output doesn't "exactly" match the specifications although I've tried to make them aware of the fact that the files are valid and accepted by the third-party. Hence, the slightly pressing need for an "exact" output file. Also XML is very new technology in my company so everyone related to the project are still picking up XML slowly.
>In some cases, due to scoping,
>the mapper may generate
>namespace
>prefixes where someone coding
>by hand wouldn't, or
>vice-versa.
Subject:Duplicate xmlns value and XML header problem Author:Tony Lavinio Date:16 Sep 2005 02:43 PM
> Hence, the slightly pressing need for an "exact" output file.
> Also XML is very new technology in my company so everyone
> related to the project are still picking up XML slowly.
There are bound to be other surprises then also. For example, the
order of attributes doesn't matter, and certain white space can be
ignored. And " or ' can be used for quotes. And empty elements have
a shorthand form. So
Subject:Duplicate xmlns value and XML header problem Author:Simon Templar Date:19 Sep 2005 12:42 PM
Thanks for the input Tony. In my case we've already acheived the correct order of appearance of tags apart from the duplicate xmlns 'issue' that still persists after updating Stylus to the latest Build (377n).
Also, I have downloaded in installed the latest Build but I still can't get rid of the duplicate namespace. Apart from that now the prefixes are automatically prefixed to the tags which has created an additional step of removing those manually. And because I am using a common schema now that is also added in addition to the original one.
Unless I am using the XSLT mapper completely wrong I can't figure out a way to get my output file in the desired format. I'd request someone to please create an XSLT that'll get the results that I am trying to achieve. If that's just how the product funtions then I just have to accept it and move on. I am attaching the following files: