schema namspace in output for no reason
Added by Anonymous over 18 years ago
Legacy ID: #3684455 Legacy Poster: Oliver Meyer (ormek)
Hi, I try to sort some dialog entries, but Saxon 8B adds the schema namespace with the prefix xsi: to my output document. What am I missing? It seems to me that the schema schema is not used in the instance document, why does it appear? Can someone enlighten me? Thanks in advance, Oliver Input is a file like: <?xml version="1.0" encoding="UTF-8"?> <l10:localization xmlns:l10="http://www.synchronica.com/SydemasL10n"> <l10:dialog> <l10:key>O1262</l10:key> <l10:value>Turn it off</l10:value> </l10:dialog> <l10:dialog> <l10:key>O1307</l10:key> <l10:value>Turn CB off</l10:value> </l10:dialog> <l10:dialog> <l10:key>O1197</l10:key> <l10:value>Batt. Display</l10:value> </l10:dialog> </l10:localization> The style sheet lookes like: <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Id: Excel2Localization.xsl,v 1.2 2006/04/10 12:55:32 omeyer Exp $ Sort the dialog elements of a given localization file by their keys. This is for easy comparison. --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ki="http://diagnose.benq.com/KanaImport" xmlns:l10="http://www.synchronica.com/SydemasL10n" > <xsl:output indent="yes" encoding="UTF-8" method="xml"/> <xsl:template match="/"> <l10:localization> <xsl:apply-templates select="l10:localization/l10:dialog"> <xsl:sort select="l10:key"/> </xsl:apply-templates> </l10:localization> </xsl:template> <xsl:template match="l10:dialog"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> And the result looks like this (but with the correct keys and values. These are just cut outs): <l10:localization xmlns:l10="http://www.synchronica.com/SydemasL10n" xmlns:ki="http://diagnose.benq.com/KanaImport"> <l10:dialog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <l10:key>CommandFailed</l10:key> <l10:value>Remote Diagnosis was terminated because of a device error.</l10:value> </l10:dialog> <l10:dialog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <l10:key>DataItemAccessForbidden</l10:key> <l10:value>Remote Diagnosis was blocked by another application.</l10:value> </l10:dialog> <l10:dialog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <l10:key>DataItemNotExists</l10:key> <l10:value>Your mobile phone is not configured properly for Remote Diagnosis.</l10:value> </l10:dialog> </l10:localization>
Replies (3)
Please register to reply
RE: schema namspace in output for no reason - Added by Anonymous over 18 years ago
Legacy ID: #3684505 Legacy Poster: Michael Kay (mhkay)
The l10:dialog elements are created in your result file by copying from the source document: xsl:copy-of copies an element together with all its in-scope namespaces. I think that the xsi namespace must be present in the source document despite the fact that it's not in the version you have shown us. You can prevent xsl:copy-of copying namespaces by specifying copy-namespaces="no", but I think it would be a good idea to find out why the namespace is there in the first place. If necessary, please post a complete source document and stylesheet so I can reproduce the problem (or not). You can post attachments in the support-requests section of the site.
RE: schema namspace in output for no reason - Added by Anonymous over 18 years ago
Legacy ID: #3684530 Legacy Poster: Oliver Meyer (ormek)
First of all thanks for the prompt reply and usefull hint. Adding copy-namespaces="no" solved MY problem. I will add a support request with all nescessary documents.
RE: schema namspace in output for no reason - Added by Anonymous over 18 years ago
Legacy ID: #3684541 Legacy Poster: Oliver Meyer (ormek)
No need for a support request. It was my mistake. I processed another file than I expected and that had an xsi prefix and namespace defined. Sorry to bother.
Please register to reply