xsl-list
[Top] [All Lists]

Re: [xsl] Java Extension Optimization

2013-10-18 16:12:59
There's no completely clean way of adding code with side-effects to an XSLT 
transformation, but my usual way to do this is to use xsl:value-of:

<xsl:value-of 
select="xisComDocRsrcs:addImage($commonDocResources,'arrow_summary_path.gif')"/>

Saxon goes to special efforts to avoid reasoning that the return type of the 
method is void and therefore calling it has no effect on the transformation....

Michael Kay
Saxonica


On 18 Oct 2013, at 21:04, Craig Sampson wrote:

Hello,
 I have several java extensions that I use to pass data to other processes 
from my transforms. I've been using xml:message's to write unnecessary values 
to my log file to prevent Saxon from discarding my variables, since it 
doesn't see them used/referenced in my transform.

 Here's an example:

           <xsl:variable name="keepGraphic" 
select="xisComDocRsrcs:addImage($commonDocResources,'arrow_summary_path.gif')"/>
           <xsl:if test="$keepGraphic=true()">
             <xsl:message>xislog~debug::keepGraphic arrow_summary_path.gif 
<xsl:value-of select="$keepGraphic"/></xsl:message>
           </xsl:if>

 In this case I am letting the extension know that I want a particular 
graphic included with the deliverable that I am creating. This extension 
prevents unused graphics from finding their way into EPUB deliverables where 
they cause problems.

 Is there a better way to prevent Saxon from discarding my extension that 
doesn't require me to write something to an output stream?

Thanks,
  Craig


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>