Hello,
I`d like to pass a parameter other than host or port to a stylesheet in my 
binding manager xml input file (JBoss4.0.3 SP1). In particular, I want to be 
able to specify the AJP port explicitely, rather then by computing a difference 
from HTTP port as in the standard example.
This should work using the the following syntax (quote from admin guide):
anonymous wrote : 
  | <delegate-config>
  | <xslt-config configName="ConfigurationElement"><![CDATA[
  | Any XSL document contents...
  | ]]>
  | </xslt-config>
  | <xslt-param name="param-name">param-value</xslt-param>
  | <!-- ... -->
  | </delegate-config>
  | 
The parameter name and value is indeed submitted to the transformer as can be 
seen in XSLTConfigDelegate.java:

  |          // xslt-param are transform parameters
  |          for(int a = 0; a < attributes.getLength(); a ++)
  |          {
  |             Element attr = (Element) attributes.item(a);
  |             String name = attr.getAttribute("name");
  |             if( name.length() == 0 )
  |                throw new IllegalArgumentException("attribute element #"
  |                             +a+" has no name attribute");
  |             String attrExp = MetaData.getElementContent(attr);
  |             String attrValue = 
StringPropertyReplacer.replaceProperties(attrExp);
  |             transformer.setParameter(name, attrValue);
  | 
  |             log.debug("set "+name+" parameter to:"+attrValue);
  |          }
  | 

However, I found no way of getting the parameter passing to work. 
Interestingly, I can state that the parameters declared in the script are not 
totally ignored - this is verified by using a default value via 
anonymous wrote : 
  | <xsl:param name="portAJP" select="9999"/>
  | 
This will always result in usage of port 9999, though, even if I actually pass 
a parameter. If I don`t use the default, like
anonymous wrote : 
  | <xsl:param name="portAJP"/>
  | 
the port is assigned to 8009 - my script is pointless.
 My actual xml file looks as follows:
anonymous wrote : 
  |       <service-config name="jboss.web:service=WebServer"
  |          delegateClass="org.jboss.services.binding.XSLTFileDelegate"
  |          >
  |          <delegate-config>
  |             <xslt-config configName="ConfigFile"><![CDATA[
  |    <xsl:stylesheet
  |          xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
  | 
  |      <xsl:output method="xml" />
  |      <xsl:param name="port"/>
  |      <xsl:param name="portAJP"/>
  |      
  |      <xsl:variable name="portHttps" select="$port + 363"/>
  | 
  |      <xsl:template match="/">
  |        <xsl:apply-templates/>
  |      </xsl:template>
  | 
  |       <xsl:template match = "Connector">
  |          
  |             <xsl:for-each select="@*">
  |             <xsl:choose>
  |                <xsl:when test="(name() = 'port' and . = '8080')">
  |                   <xsl:attribute name="port"><xsl:value-of select="$port" 
/></xsl:attribute>
  |                </xsl:when>
  |                <xsl:when test="(name() = 'port' and . = '8009')">
  |                   <xsl:attribute name="port"><xsl:value-of 
select="$portAJP" /></xsl:attribute>
  |                </xsl:when>
  |                <xsl:when test="(name() = 'redirectPort')">
  |                   <xsl:attribute name="redirectPort"><xsl:value-of 
select="$portHttps" /></xsl:attribute>
  |                </xsl:when>
  |                <xsl:when test="(name() = 'port' and . = '8443')">
  |                   <xsl:attribute name="port"><xsl:value-of 
select="$portHttps" /></xsl:attribute>
  |                </xsl:when>
  |                <xsl:otherwise>
  |                   <xsl:attribute name="{name()}"><xsl:value-of select="." 
/></xsl:attribute>
  |                </xsl:otherwise>
  |             </xsl:choose>
  |             </xsl:for-each>
  |             <xsl:apply-templates/>
  |          
  |       </xsl:template>
  | 
  |      <xsl:template match="*|@*">
  |        <xsl:copy>
  |          <xsl:apply-templates select="@*|node()"/>
  |        </xsl:copy>
  |      </xsl:template>
  |    </xsl:stylesheet>
  |    ]]>
  |             </xslt-config>
  |         <xslt-param name="portAJP">9999</xslt-param>
  |          </delegate-config>
  |          
  |       </service-config>
  | 

Thanks a lot
- regards, Thomas

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3920900#3920900

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3920900


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to