passing the ContextPath to XSL


in your ServletFilter

transformer.setParameter(
    "contextPath", filterConfig.getServletContext().getContextPath());

in your XSL

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:output method="xml"
              doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
              doctype-public="-//W3C//DTD XHTML 1.1//EN" indent="yes"/>
  <xsl:param name="contextPath"/>
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
      <head>
        <link rel="stylesheet"
              href="{$contextPath}/css/mycss.css"
              type="text/css"/>
      </head>
      <body/>
    </html>
  </xsl:template>
</xsl>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s