On Jan 26, 2009, at 3:35 PM, Lee Surma wrote:
FYI I am a newbie who has been tasked with maintaining
some existing XSLT. I would like to make some XSLT dynamic
across environments using a choose statement.
Is there a way I can determine the root of the Web server
where the XSLT document is so I can hard code URL
addresses etc based on if I'm in Dev vs Production?
Example:
dev.imanewbiefool.com Vs
uat.imanewbiefool.com or
www..imanewbiefool.com
In HTML you can use the CGI REMOTE_HOST variable.
Anyway, you can't get it with XSL alone. You probably want to vary on
parameters or some non-source-controlled XML lookup that you pull in
with the document function.
Another way would be to wrap the source xml instance with the host
information. For example:
<dev.imanewbiefool.com>
... the wrapped xml...
</dev.imanewbiefool.com>
and
<www.imanewbiefool.com>
... the wrapped xml...
</www.imanewbiefool.com>
Then, instead of using a possibly huge choose, you can just match the
root element:
<xsl:import href="hosts.xsl"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
and in hosts.xsl you could either import your individual hosts
statically or generate your hosts based of a directory containing
however many unique host xsls. Or just match them there:
<xsl:template match="dev.imanewbiefool.com">
... do whatev...
</xsl:template>
<xsl:template match="www.imanewbiefool.com">
... do whatev...
</xsl:template>
-Rob
Lee
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--