cancel
Showing results for 
Search instead for 
Did you mean: 

parseXMLDocument() from an XSLT via a JSP

kooktroop
Champ in-the-making
Champ in-the-making
Is it possible to do parseXMLDocument() so that I can access the contents of another XML file from within an XSLT?

This XSLT is being applied by a JSP page, not by Alfresco's rendering engine. I had a look through the samples but nothing immediately jumped out at me.

This is the sort of thing I am trying to achieve, but receiving a "Could not compile stylesheet" exception is:


<xsl:template match="pm:activityreference">
        <xsl:variable name="activity"><xsl:value-of select="parseXMLDocument( @ref )" /></xsl:variable>
        <li><a href="../activities/activity.jsp?"><xsl:value-of select="activity//pm:name" /></a></li>
</xsl:template>
‍‍‍‍‍‍

Where @ref is a reference to the "activity" xml file, e.g. "/activities/Need Exploration.xml".
2 REPLIES 2

arielb
Champ in-the-making
Champ in-the-making
this isn't something that alfresco provides out of the box.  the xslt rendering engine is configured with a bunch of extension functions and variables to enable the form data functions to work.  it's an interesting use case that shouldn't be too hard to support.  file a feature request in jira.

in the meantime, it shouldn't be too hard to bind the form data functions within the servletcontextadapter to static methods on your xslt processor instance.  take a look at the xalan documentation for more information on that.

kooktroop
Champ in-the-making
Champ in-the-making
Thanks for your reply Ariel.

I have submitted a feature request; http://issues.alfresco.com/browse/WCM-406