[sword-devel] namespaces in xsl

Matěj Cepl mcepl at redhat.com
Thu Jul 26 14:08:07 MST 2012


On 26/07/12 22:26, 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.

Take a look at 
http://luther.ceplovi.cz/git/?p=czekms-csp_bible.git;a=blob;f=CEP2OSIS.xsl;h=7f84af2b870fec6068c0c2eb77ce46142a16d4eb;hb=HEAD

That's XSL script which completely generates CzeCSP Bible from the 
original proprietary (read, bag-of-random-elements-hacked-together) XML 
scheme to OSIS.

> 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" />

That's wrong ... you have namespace only for the stylesheet itself, you 
need something for the incoming document as well something (maybe empty) 
for output.

> 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.

Take a look also at 
http://duckduckgo.com/?q=xml%20namespace%20site%3Axml.com

Take a look at my example and let us know, if you have more questions.

Blessings,

Matěj
-- 
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC

If trains stop at train stations, what happens at work stations?




More information about the sword-devel mailing list