[sword-devel] namespaces in xsl

Greg Hellings greg.hellings at gmail.com
Thu Jul 26 13:38:12 MST 2012

Oy, I've run into fun with namespaces before as well on XSL documents.
Going by the seat of my pants here, but I think my solution had to be
two step.

First, I would declare
xmlns:tei="http://www.crosswire.org/2008/TEIOSIS/namespace" in the XSL

Secondly, I would alter my matches statements in the XSL templates to
include the tei: namespace in them.

I _think_ that is the solution you're looking for. You'll also need to
include any other namespaces for elements outside of the tei
namespace. But I could also be very wildly mistaken on this. Mixing
and matching elements from multiple namespaces in an XML document and
handling it in XSL is something I've always tripped over because it
only comes up once in a blue moon for me.


On Thu, Jul 26, 2012 at 3:26 PM, Daniel Owens <dcowens76 at gmail.com> wrote:
> I am writing a stylesheet to display Abbott-Smith's Manual Greek Lexicon of
> the New Testament from Github where I will post releases. I have no idea how
> to get the namespace declaration right in the xsl file. I have googled and
> tried several solutions, but so far nothing works.
> The source document, abbott-smith.xml, begins:
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="abbott-smith.xsl"?>
> <TEI xmlns="http://www.crosswire.org/2008/TEIOSIS/namespace"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.crosswire.org/2008/TEIOSIS/namespace
> http://www.crosswire.org/OSIS/teiP5osis.1.4.xsd">
> Here is how abbott-smith.xsl begins:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" />
> The only way I can get the xsl to work is to delete the namespace
> declaration from the source document, which does not seem like good
> practice. Simply adding
> xmlns="http://www.crosswire.org/2008/TEIOSIS/namespace" to <xsl:stylesheet>
> in abbott-smith.xsl does not work. Nor does adding it as xmlns:tei and
> adding /tei: to the first XPath query.
> Can anyone help me?
> Daniel
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

More information about the sword-devel mailing list