On 11/04/2014 23:35, Larry Evans wrote:
><!--How to avoid this hardcoding of xpath-default-namespace?-->
<xsl:template match="html">
the model really is that you _want_ to hardcode the namespace just as
you have hardcoded the local-name "html" they are just two parts of the
same name. However if you want to match (say) html in no-namepsace and
html in the xhtml namespace you could use
html|h:html
where h is bound to http:/www.w3.org/1999/xhtml
or you could use
*:html
which matches html in any namespace
or to do exactly what you said, of just matching the namespace used in
the source you can do a two pass strategy that first uses a stylesheet
that just uses namespace-uri(/*) on the source document to get the
namespace, then transforms the main stylesheet to set the default
namespace, then transforms the document with the generated stylesheet.
or finally you can do a two pass strategy that first transforms the
source document to a known namespace (say no-namespace") just using
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="">
then you can transform this document which has a known namespace structure.
David
--~------------------------------------------------------------------
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>
--~--