[xsl] Processing input xml containing containing namespace switch

Subject: [xsl] Processing input xml containing containing namespace switch
From: "Revill, D.J." <D.J.Revill@xxxxxx>
Date: Thu, 15 Jul 2004 11:20:14 +0200

I'm having difficulty processing an input xml document that contains an
embedded section of xml in a different namespace to that of the root element.
The new namespace (and also schema location) are declared at the point they
occur in the input. My specific problem is that I can't seem to match on
<osis> (point where the new namespace begins), or any of the elements that
fall within <osis>. Its as if the xslt processor doesn't "see" the elements in
the new namespace. I'm using Saxon 6.4.4 to process and an xslt 1.0

- I declared the extra namespaces used in the input within my stylesheet
- I note that the namespace
xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace"; doesn't specify a
specific prefix (is this a problem?)
- I checked using the namespace-uri() within which namespace <osis>...</osis>
is and this is given as http://www.bibletechnologies.net/2003/OSIS/namespace

Input xml is:

<?xml version="1.0" encoding="UTF-8"?>
	<a>Some content</a>
		<osisText osisIDWork="NBV" osisRefWork="Bible" xml:lang="nl">
		<header>Some text</header>
		<div type="book" osisID="Mark">
		<title type="main">Het evangelie volgens Marcus</title>
		<p>Some text</p>

Stylesheet is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"	xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
	<xsl:strip-space elements="*"/>

	<xsl:template match="/">

	<xsl:template match="osis">
		<MATCH name="{name()}">
			<!-- Other logic here -->

	<!-- Defualt template to catch and output all elements, attributes, and
element content-->
	<xsl:template match="*|@*|text()">
			<xsl:apply-templates select="*|@*|text()"/>


- The template match="osis" doesn't match on <osis>
- Nor does match="osis[namespace-uri() =
- However *[namespace-uri() =
'http://www.bibletechnologies.net/2003/OSIS/namespace'] does match, but is
very generic
- My default catch all template match="*|@*|text()" also matches.

Any ideas as to why match="osis" doesn't work? Am I missing a ns prefix - if
so what? Any help much appreciated - probably I missed something obvious.


Derek Revill

Specialist XML/SGML, Digitaal Productiecentrum

Elektronische Diensten
Universiteitsbibliotheek, Universiteit van Amsterdam
Singel 425, 1012 WP Amsterdam

Current Thread