[sword-devel] How to represent special characters in osisID attributes in a gen book

Brian J Dumont brian.j.dumont at gmail.com
Tue Oct 4 08:36:33 MST 2011

Per Chris Little (circa 2009 when I asked the same question:

    The relevant bit of the regex is: (\p{L}|\p{N}|_|(\\[^\s]))+

    The last option permits escaping any non-space character with a
    leading \. Further to that, NBSP (0xA0), by convention, represents
    space (0x20) in osisID/osisRef. But it will need to be escaped since
    it's not a letter, number, or underscore.

In my experience since then, the non-breaking space is far more 
confusing than it's worth.  I would suggest:
<div type="chapter" osisID="Gods_Sovereignty">

A bit crude, but it has a number of advantages:
- It is valid
- I think it works on all SWORD front-ends that support genbooks
- It doesn't get messed up by code that is passing a link (imagine that 
someone later wants to create a hyperlink from a different module to 
this spot in your module)


On 10/04/2011 11:05 AM, Martin Denham wrote:
> In gen books it seems that the osisID is normally used as the chapter 
> title e.g.
> <div type="chapter" osisID="Chapter 1">
> However some chapter titles can contain special characters e.g.
> <div type="chapter" osisID="God's Sovereignty">
> contains an apostrophe.
> I thought that, being an xml attribute, it should be:
> <div type="chapter" osisID="God's Sovereignty">
> but that gives the error:
>     The value 'God's Sovereignty' of attribute 'osisID' on element 
> 'div' is not valid with respect to its type, 'osisIDType'.
> So how should a chapter title of "God's Sovereignty" be represented?
> Thanks
> Martin
> _______________________________________________
> 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

The question is not "Have you accepted Jesus into your heart", but "Has
Jesus accepted you into His heart?"; not "have you given your whole
life for God", but "has God given His whole life for you"
	- Pr Bryan Wolfmueller, 2010

More information about the sword-devel mailing list