[jsword-devel] How can I get a list of cross-references?

Chris Burrell chris at burrell.me.uk
Wed Feb 6 13:02:57 MST 2013


Hi Joachim

It depends on what you're trying to achieve with this. Most people will use
an XSL transformation, maybe a cut down version of simple.xsl just to do
the notes? (
http://www.crosswire.org/svn/jsword/trunk/bibledesktop/src/main/resources/xsl/cswing/simple.xsl).
If that's what you're up for, then see below for some sample code I use.

Or, if you want to do this purely in Java, you could use
OSISUtil.getNotes() & OSISUtil.getReferences(). You have less control on
the ouput, but this may be all you need?

Chris

Your code can call XmlUtil.writeToString(htmlsep) on the return value of
the following method:


    private TransformingSAXEventProvider executeStyleSheet(final
List<LookupOption> options,
            final String interlinearVersion, final BookData bookData, final
SAXEventProvider osissep,
            final InterlinearMode displayMode) throws TransformerException {
        final XslConversionType requiredTransformation =
identifyStyleSheet(bookData.getFirstBook()
                .getBookCategory(), options, displayMode);

        final TransformingSAXEventProvider htmlsep =
(TransformingSAXEventProvider) new Converter() {
            @Override
            public SAXEventProvider convert(final SAXEventProvider
provider) throws TransformerException {
                try {
                    final String file = requiredTransformation.getFile();
                    final URI resourceURI =
getClass().getResource(file).toURI();

                    final TransformingSAXEventProvider tsep = new
TransformingSAXEventProvider(resourceURI,
                            osissep);

                    // set parameters here
                    setOptions(tsep, options, bookData.getFirstBook());
                    return tsep;
                } catch (final URISyntaxException e) {
                    throw new StepInternalException("Failed to load
resource correctly", e);
                }
            }
        }.convert(osissep);
        return htmlsep;
    }



On 6 February 2013 19:53, Joachim Ansorg <nospam at joachim-ansorg.de> wrote:

> Hi all,
> I'm fairly new to the JSword api, but I like it so far...
>
> Which is the best way to retrieve a list of cross-references for a given
> verse of the Bible?
> Basically I want to create a list of available cross references of the
> Bible. I've looked at the Javadocs but couldn't find a good place to start.
>
> Regards,
> Joachim
> --
> <>< Re: deemed!
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20130206/ba3f0f7c/attachment.html>


More information about the jsword-devel mailing list