Hello. Having finally had time to get back to this and read the documentation I am still no further forward, as I still see no way of "registering" my POJO class or providing an instance of it so I can access it within my Style Sheet.
There are methods to registerExtensionFunction available on the Processor in the s9api, but my object isn't derived from the expected type.
I know what I want to do can be done as I have a version using a different Class albeit within the Oxygen IDE, but how to actually :
Code:
processor = new Processor(false) ;
**************
processor.setExtension(my.extension.class) ;
processor.setExtensionInstance(myInstance) ;
**************
compiler = processor.newXsltCompiler() ;
executable = compiler.compile(style) ;
source = processor.newDocumentBuilder().build(streamSource) ;
output = processor.newSerializer(new File(f.toString())) ;
transformer = executable.load() ;
transformer.setInitialContextNode(source) ;
transformer.setInitialTemplate(new QName("build")) ;
transformer.setDestination(output) ;
transformer.transform() ;
So in the XSLT I can use this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:RM="java:you.RM.Definition" exclude-result-prefixes="xs RM">
<xsl:output method="xml" indent="yes" encoding="UTF-8" version="1.0"/>
<xsl:template name="build">
<xsl:variable name="Def" select="RM" />
<xsl:element name="definition">
<xsl:attribute name="title" select="RM:getTitle($Def)"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
This is driving me to distraction so I'd really appreciate some help here.
--
William