我正在为我的XSL进行额外的国际化.我已经看到很多创建dictionary.xml文件并通过文档('dictionary.xml')将其加载到我的XSL中的示例.我想做类似的事情,但我不想在磁盘上创建和存储dictionary.xml文件,我宁愿在服务器启动时从SQL构建它,并将Document对象保存在Java内存中.我想将字典文档作为参数传递给变换器,以便我的XSL转换函数可以使用它.但是,它似乎没有起作用.
相关的Java代码:
Document dictionary = TranslationDictionary.getDictionaryDocument();
transformer.setParameter("dictionary", dictionary);
Run Code Online (Sandbox Code Playgroud)
字典文件内容:
<dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<translatedString dictionaryId="BASIC_DETAILS">
<language id="es" value="Detalles Básicos"/>
</translatedString >
<translatedString dictionaryId="VEHICLE_INFORMATION">
<language id="es" value="Información del Vehículo"/>
</translatedString >
<translatedString dictionaryId="STRUCTURE">
<language id="es" value="Estructura"/>
</translatedString >
<translatedString dictionaryId="DRIVER_INFORMATION">
<language id="es" value="Información del Conductor"/>
</translatedString >
<translatedString dictionaryId="MAINTENANCE_AND_FEUL">
<language id="es" value="Mantenimiento & Combustible"/>
</translatedString >
<translatedString dictionaryId="PURCHASING">
<language id="es" value="Compra"/>
</translatedString >
</dictionary>
Run Code Online (Sandbox Code Playgroud)
XSL文件:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://www.test.com">
<xsl:param name="dictionary"/>
<xsl:param name="language" select="'es'"/>
<xsl:template match="/">
<xsl:message>
<xsl:copy-of select="$dictionary/dictionary/translatedString[@dictionaryId='BASIC_DETAILS']/language[@id='es']/@value"/>
</xsl:message>
</xsl:template> …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个使用Prototype编写的网站,但我们正在逐步将其转换为jQuery.很多页面更新都是通过Prototype的Ajax.Updater完成的.但是,有时Prototype删除和替换的元素已经运行了jQuery小部件,因此$ .cache引用了小部件创建的其他元素.由于jQuery没有删除DOM,因此当它们被删除时,它没有机会从$ .cache中清除这些元素的数据,最终导致内存泄漏.有没有办法告诉jQuery检查它的$ .cache并丢弃不再在DOM中的元素的任何数据?