xsl-list
[Top] [All Lists]

Re: [xsl] How to force prefixes instead of expanded qnames?

2010-08-17 19:41:49
Hi,

Although I don't quite understand this answer fully it sounds
encouraging. It seems not all is lost.

I didn't want to bother you with boring details. Maybe this is a
significant extract of the code:

<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:mpx="http://www.mpx.org/mpx";>
...
    <xsl:template match="/">
      <Repository xmlns="http://www.openarchives.org/OAI/2.0/static-repository";
        xmlns:oai="http://www.openarchives.org/OAI/2.0/";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/static-repository
       http://www.openarchives.org/OAI/2.0/static-repository.xsd";>
...
<oai:metadata>
  <xsl:element name="mpx:{name()}">
    <xsl:namespace name="mpx" select="'http://www.mpx.org/mpx'"/>
    <xsl:namespace name="xsi"
      select="'http://www.w3.org/2001/XMLSchema-instance'"/>
    <xsl:attribute name="xsi:schemaLocation"
      select="'http://www.mpx.org/mpx
      file:/c:/cygwin/home/Mengel/usr/levelup/lib/mpx-lvl2.v2.xsd'"/>
...
    <xsl:copy-of select="mpx:*"/>
  </xsl:element>
</oai:metadata>
...

I tried various variants on the select part of copy-of, but it seems
not to change the output.

thanks!
Maurice



On Tue, Aug 17, 2010 at 5:32 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
If you don't show us your code then we can't tell you how to change it.

Most of the time XSLT 2.0 gives the processor no discretion about choice of
prefixes: you get the prefix you ask for. For example, xsl:copy-of copies
names from the source document (prefixes and all), while literal result
elements copy them from the stylesheet.

Michael Kay
Saxonica

On 17/08/2010 20:53, Maurice Mengel wrote:

Hi there!

I guess this must have come up before, but I can't find it.

I get this kind of a result which works fine, but is a bit more
difficult to read than necessary:

<Repository xmlns:oai="http://www.openarchives.org/OAI/2.0/";
            xmlns="http://www.openarchives.org/OAI/2.0/static-repository";
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xmlns:mpx="http://www.mpx.org/mpx";

xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/static-repository
   http://www.openarchives.org/OAI/2.0/static-repository.xsd";>
...
         <oai:metadata>
            <mpx:multimediaobjekt
xsi:schemaLocation="http://www.mpx.org/mpx
file:/c:/cygwin/home/Mengel/usr/levelup/lib/mpx-lvl2.v2.xsd"
                                  exportdatum="2010-04-19T16:39:14"
                                  mulId="7216">
               <bearbDatum xmlns="http://www.mpx.org/mpx";>12.12.2005
14:32:13</bearbDatum>
               <multimediaFarbe
xmlns="http://www.mpx.org/mpx";>farbig</multimediaFarbe>
               <multimediaFormat xmlns="http://www.mpx.org/mpx";>RF
(6x6 cm)</multimediaFormat>
...

I would prefer having the namespace written as a prefix like in
<mpx:multimediaobjekt>.

This is an xslt 2 transformation and I am using copy-of to create
those elements where I don't like the output.

Thanks!
Maurice

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