[sword-devel] namespaces in xsl

David Troidl DavidTroidl at aol.com
Thu Jul 26 17:00:56 MST 2012


Here's the root element of an OSIS document:
<osis 
xsi:schemaLocation="http://www.bibletechnologies.net/2003/OSIS/namespace 
http://www.bibletechnologies.net/osisCore.2.1.1.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace">

And here is a style sheet for transforming it:
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:osis="http://www.bibletechnologies.net/2003/OSIS/namespace"
                 xmlns="http://www.w3.org/1999/xhtml">

Notice how the xmlns:osis from the style sheet matches the xmlns from 
the XML document.  The osis prefix distinguishes the elements that come 
from that namespace.

David

On 7/26/2012 4:26 PM, Daniel Owens 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