[jsword-devel] Using java inside a stylesheet

Joe Walker joseph.walker at gmail.com
Sat Aug 20 10:40:54 MST 2005


I don't have a problem with this at all. I've been very close to doing
something just like this a number of times, but never taken the jump.
Good one.

Joe 

On 8/11/05, DM Smith <dmsmith555 at yahoo.com> wrote:
>  I am checking in a change to the stylesheet that uses JSword's java code to
> convert an osisID to a friendly internationalized version. I have
> highlighted how it is done. Basically you tell the stylesheet that you will
> be using java but to be quiet about it. Then you create variables and then
> call methods on them. The odd difference is that the notation is not
> object->method() but method(object). So you just put the object at the front
> of the list. Xalan sorts it out.
>  
>  I think this is marginally faster than what was there before.
>  
>  Yes, this does create a dependency upon xalan, but it is bundled in Java
> since 1.4.
>  
>  <xsl:stylesheet
>    xmlns="http://www.w3.org/TR/REC-html40"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    version="1.0"
>    xmlns:jsword="http://xml.apache.org/xalan/java"
>    extension-element-prefixes="jsword">
>  
>    <xsl:template match="verse" mode="print-notes">
>      <xsl:if test="./note">
>        <xsl:variable name="verse"
> select="jsword:org.crosswire.jsword.passage.VerseFactory.fromString(@osisID)"/>
>        <a href="#{@osisID}">
>          <xsl:value-of select="jsword:getName($verse)"/>
>        </a>
>        <xsl:apply-templates select="./note" mode="print-notes" />
>        <div><xsl:text>&#160;</xsl:text></div>
>      </xsl:if>
>    </xsl:template>
>  </xsl:stylesheet>
>  
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
> 
> 
>



More information about the jsword-devel mailing list