cancel
Showing results for 
Search instead for 
Did you mean: 

how to include another XSL file?

tak
Champ in-the-making
Champ in-the-making
I have some trouble to use alfresco WCM 2.0.

I would like to make an XSL template including another XSL files,
however I couldn't produce desired HTML file.

What I wrote in XSL is like that.

<xsl:include href="/menu_fragment.xsl" /> <!– (1) –>

<xsl:variable name="t" select="document('/aaa.xml')"/> <!– (2) –>
<xsl:apply-templates select="$t/some_ns:menu" /> <!– (3) –>

(1) include another XSL template.
(2) bind another xml contents.
(3) apply template defined in (1) to bounded xml contents.

in (1), I tried these.
(a)I placed menu_fragment.xsl in web-project root folder.
(b) Same web forms space as this template.
© I tried <xsl:include href="${alf.parent_path}/aegif_menu_fragment.xsl" />

anyone knows how to describe XSL and where to place included XSL files?
:shock:
17 REPLIES 17

edgar
Champ in-the-making
Champ in-the-making
Hi,

I have got the <xsl:include> functionality working now in Alfresco 2.1R1 Community, but unfortunately only when running on Windows. We also run an Alfresco server on Linux and there the XSL includes do not work.

What I did was:

- Generic XSL code (<xsl:template>) in XSL includes in the Web Project's /xsl folder. E.g. /xsl/head.xsl.
- In my Web Form XSL template include such a file using:

<xsl:include href="/xsl/head.xsl" />


This works fine when running on Windows but when Alfresco is running on Linux I get this error when trying to save a content item based on this Web Form:

error regenerating rendition using page_home.xsl: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: ElemTemplateElement error: head

In Alfresco's log I see:

09:33:08,332 ERROR [web.forms.XSLTRenderingEngine] javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: ElemTemplateElement error: head
INFO   | jvm 1    | 2007/07/13 09:33:08 | 09:33:08,351 ERROR [ui.common.Utils] error regenerating rendition using page_content.xsl: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: ElemTemplateElement error: head
INFO   | jvm 1    | 2007/07/13 09:33:08 | org.alfresco.web.forms.RenderingEngine$RenderingException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: ElemTemplateElement error: head
INFO   | jvm 1    | 2007/07/13 09:33:08 |    at org.alfresco.web.forms.XSLTRenderingEngine.render(XSLTRenderingEngine.java:484)
INFO   | jvm 1    | 2007/07/13 09:33:08 |    at org.alfresco.web.forms.XSLTRenderingEngine.render(XSLTRenderingEngine.java:378)



Any ideas? I guess it has something to do with the fact that the CIFS mount folder is different on Linux (/media/alfresco/cifs/v) than it is on Windows?

PS: our Virtualization Server runs just fine on Linux.
PPS: we run our CIFS Samba mount on a different port than the default (because we already had another Samba mount on the machine).

Another thing: I would much prefer to store the XSL include files in the Data Dictionary instead of in my Web Project, since that it where they belong. However I can only access an XSL include file when I store it in the _same_ folder as the Web Form itself. That is no use to me, since the purpose of these XSL include files is that they can be reused by multiple Web Forms! Or am I missing something?

cheers,

Edgar

kvc
Champ in-the-making
Champ in-the-making
Edgar:

Can u please file a bug?  We'll look into getting addressed ASAP.

Kevin

edgar
Champ in-the-making
Champ in-the-making
Can u please file a bug?  We'll look into getting addressed ASAP.

I created this issue:
http://issues.alfresco.com/browse/WCM-659

randomman
Champ in-the-making
Champ in-the-making
On a slightly different subject, is it possible to include a jsp instead?

I notice that with XSDs you can include a JSP to dynamically create a schema (e.g. to populate a web form select box as per the sample site).

I was wondering if you could include a JSP at the rendition point of the web form process?

I was experimenting with ways to get web form data into a database and this idea came to me. Am I stupid to even attempt this?  :wink:

shchavla
Champ in-the-making
Champ in-the-making
Hello Skilled Smiley Happy
   
I've tried to include another xslt from subspace of webform
<xsl:include href="xsl/included.xsl"/>

and, got the following error

org.alfresco.web.forms.RenderingEngine$RenderingException: errors encountered du
ring transformation:
Can u tell me the way how to handle this problem?
it is not so handy to keep all of included xslt in same space.
Any ideas will be appreciated.
Error:

15:38:47,343 ERROR [ui.common.Utils] Error generating rendition using including.
xsl: errors encountered during transformation:
unable to resolve href xsl/included.xsl

org.alfresco.web.forms.RenderingEngine$RenderingException: errors encountered du
ring transformation:
unable to resolve href xsl/included.xsl

        at org.alfresco.web.forms.XSLTRenderingEngine.render(XSLTRenderingEngine
.java:510)
        at org.alfresco.web.forms.XSLTRenderingEngine.render(XSLTRenderingEngine
.java:379)
        at org.alfresco.web.forms.RenderingEngineTemplateImpl.render(RenderingEn
gineTemplateImpl.java:306)
        at org.alfresco.web.forms.RenderingEngineTemplateImpl.render(RenderingEn
gineTemplateImpl.java:279)
        at org.alfresco.web.bean.wcm.CreateWebContentWizard.saveContent(CreateWe
bContentWizard.java:473)
        at org.alfresco.web.bean.wcm.CreateWebContentWizard.next(CreateWebConten
tWizard.java:229)
        at org.alfresco.web.bean.wizard.WizardManager.next(WizardManager.java:49
😎
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
:132)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(Actio
nListenerImpl.java:61)
        at javax.faces.component.UICommand.broadcast(UICommand.java:109)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:9
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invoke
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:151)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:870)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:528)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:685)
        at java.lang.Thread.run(Thread.java:595)
:?:

stephenr85
Champ in-the-making
Champ in-the-making
I am having a similar problem. When I include a file as shown below in my xsl, I get that href /master/forms/include/content-choices.xsl could not be resolved. I've have double and triple checked the paths, and the files are in the correct place.

<xsl:include href="/master/forms/include/content-choices.xsl"/>

The virtualization server is running, and I'm having no problems including xsd's within the Web App from a Web Form schema, like below:

<xs:include schemaLocation="/master/forms/include/content-choices.xsd"/>

roxanne
Champ in-the-making
Champ in-the-making
i'm also getting this error:

unable to resolve href /included.xsl


any solution any1>?????

roxanne
Champ in-the-making
Champ in-the-making
hi tak

i tried using ur included-including example.

it doesnt work for me

i get this error:

Error generating rendition using including.xsl: errors encountered creating tranformer …
unable to resolve href \included.xsl


please let me know in case u have any solution