Fórum

XSL Content Portlet and passing parameters

thumbnail
Ash D Wilson, modificado 13 Anos atrás.

XSL Content Portlet and passing parameters

New Member Postagens: 3 Data de Entrada: 30/06/09 Postagens Recentes
I am trying to pass parameters into a stylesheet at runtime to govern the output of the XSLT, and I can't seem to figure out how to get it to work. Maybe it isn't even possible.

The XML/XSLT processes just fine, except it just isn't picking up the parameters I am trying to pass in.

It was my understanding that XSLT can pass paramaters in at runtime, but I can't find any documentation on how to do that using the XSL Content Portlet.

This is how I am trying to do it:
XML: http://myserver/acl.xml
XSL: http://myserver/acl.xsl?acl=TestValue

XML file structure:
<!--?xml version="1.0"?-->
<rules>
<acl name="nameOfACL">
<line>remark 1 blah blah</line>
<line>remark 50 General Default - Allow</line>
<line>seq 50 permit ip blah blah</line>
<line>seq 51 permit ip blah blah</line>
</acl>
</rules>


XSL:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" omit-xml-declaration="no" indent="yes" />
<xsl:param name="acl" required="yes" />
<xsl:template match="/">
   
	
		<title>ACL</title>
	
	
		<h1><xsl:value-of select="$acl" /></h1>
		<br> 
			<div style="padding:10px;">			
			<ul>
			 <xsl:for-each select="/rules/acl"> 
				<!-- Set variables -->
				<xsl:variable name="aclName" select="@name" />
				<xsl:for-each select="line">
				<xsl:text disable-output-escaping="yes">&lt;li&gt;</xsl:text>
				<xsl:value-of select="." />
				<xsl:text disable-output-escaping="yes">&lt;/li&gt; </xsl:text>
				</xsl:for-each>
			</xsl:for-each>
			</ul>
			</div>
	
  
</xsl:template>
</xsl:stylesheet>


Thanks in advance!

-Ash
Christian Schwarz, modificado 10 Anos atrás.

RE: XSL Content Portlet and passing parameters

New Member Mensagem: 1 Data de Entrada: 26/08/13 Postagens Recentes
Hi Ash,

I hope you still alive after all this years without getting any reaction. emoticon Maybe I have the reason for your problem and yes, it is even possible with a trick. ;)
Only I described the procedure in german. Sure, you can translate it by google or any other translation provider.

http://blox.chris-schwarz.de/2013/09/09/liferay-xsl-content-portlet-meets-request-parameter/

Good luck!
Christian (mail@chris-schwarz.de)