[xml] namespace-alias result-prefix


As far as I can see, the current namespace-alias implementation does exactly what is necessary according to the standard. Unfortunately, the standard defines what should happen with the namespace itself, but does not specify which prefix should be used in the result.

The current libxslt (well, I'm using libxslt 1.1.15, but it probably has not changed since; at least there is nothing about it in the changelog) just copies the prefix used in the stylesheet.

As a result, a stylesheet that starts with

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:new="http://www.w3.org/1999/XSL/TransformAlias";>
    <xsl:namespace-alias stylesheet-prefix="new" result-prefix="xsl"/>
    <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

will generate a stylesheet that starts with

<?xml version="1.0" encoding="utf-8"?>
<new:stylesheet xmlns:new="http://www.w3.org/1999/XSL/Transform";>
    <new:output ...

which is syntactically correct, but could confuse a less experienced stylesheet writer.

As we all like to standardise ;-) I would suggest to use the value of result-prefix in the output instead. That is, if there is just a single alias for a given namespace. I can't find any reason for a second one, but maybe someone else does. In that case I would suggest to use the first alias.

Please let me know whether a patch that makes this change would make it into the library, in which case I'll try to create one.

with kind regards,

Age Jan Kuperus
Wageningen UR Library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]