XSLT: need to replace document('')

Posted by Daziplqa on Stack Overflow See other posts from Stack Overflow or by Daziplqa
Published on 2010-03-17T22:22:14Z Indexed on 2010/03/17 22:41 UTC
Read the original article Hit count: 276

Filed under:

I've the following xslt file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- USDomesticCountryList - USE UPPERCASE LETTERS ONLY -->
    <xsl:variable name="USDomesticCountryList">
        <entry name="US"/>
        <entry name="UK"/>
        <entry name="EG"/>
    </xsl:variable>
    <!--// USDomesticCountryList -->

    <xsl:template name="IsUSDomesticCountry">
       <xsl:param name="countryParam"/>
       <xsl:variable name="country" select="normalize-space($countryParam)"/>
       <xsl:value-of select="normalize-space(document('')//xsl:variable[@name='USDomesticCountryList']/entry[@name=$country]/@name)"/>
    </xsl:template>
</xsl:stylesheet>

I need to replace the "document('')" xpath function, what should I use instead? I've tried to remove it completely but the xsl document doesn't work for me!

I need to to so because the problem is :

I am using some XSLT document that uses the above file, say document a. So I have document a that includes the above file (document b).

I am using doc a from java code, I am do Caching for doc a as a javax.xml.transform.Templates object to prevent multiple reads to the xsl file on every transformation request.

I found that, the doc b is re-calling itself from the harddisk, I believe this is because of the document('') function above, so I wanna replace/remove it.

Thanks.

© Stack Overflow or respective owner

Related posts about xslt