You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/10/04 18:05:32 UTC

[jira] Resolved: (XALANJ-1928) XSLTC fails to access auxilliary (non-main) xml file.

Message:

   The following issue has been resolved as CANNOT REPRODUCE.

   Resolver: Henry Zongaro
       Date: Mon, 4 Oct 2004 9:04 AM

I was unable to reproduce this problem given the information provided.  If you are still able to reproduce it, please reopen the bug report, attaching a complete sample stylesheet and complete sample input.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-1928

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-1928
    Summary: XSLTC fails to access auxilliary (non-main) xml file.
       Type: Bug

     Status: Resolved
 Resolution: CANNOT REPRODUCE

    Project: XalanJ2
 Components: 
             XSLTC
   Versions:
             2.6

   Assignee: 
   Reporter: Barys Dubauski

    Created: Thu, 19 Aug 2004 9:42 PM
    Updated: Mon, 4 Oct 2004 9:04 AM
Environment: Operating System: Other
Platform: Other

Description:
In our project we need to access non-main XML file in order to retrieve 
localized strings that will later appear in resulting HTMLs. If we use XSLTC 
as our processor it is impossible.

Example. The same example works fine in interpretive Xalan. But fails on Xalan-
XSLTC.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:xalan="http://xml.apache.org/xalan">

    <xsl:output method="html"/>
    
    <xsl:variable name="stringTable" select="document('foo.xml')"/>

    <!-- Look up the parameter key in the localized string table (loaded in 
the variable stringTable 
       based on the passed in parameter stringTableFileName).  If the key 
cannot be found then the 
       returned string will be !<key>!.
       
       Parameters:
       key - the look up key matched to the key attribute of string elements 
in the lookup table
   -->
	

    <!-- Perhaps not the fastest approach but it is compatible with both XSLTC 
and interpretive Xalan -->
    <xsl:template name="getLocalizedString">
        <xsl:param name="key"/>
        <xsl:value-of select="$key"/>
        <xsl:variable name="lookupString" select="$stringTable/strings/string
[@key=$key]"/>
        <xsl:choose>
            <xsl:when test="$lookupString != ''">
                <xsl:value-of select="$lookupString"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:element name="a">
                    <xsl:attribute name="name">MISSING_L10N_KEY</xsl:attribute>
                    <xsl:text>!!</xsl:text>
                    <xsl:value-of select="$key"/>
                    <xsl:text>!!</xsl:text>
                </xsl:element>
            </xsl:otherwise>
        </xsl:choose> 
    </xsl:template>
</xsl:stylesheet>


Example of XML file

<?xml version="1.0" encoding="UTF-8" ?>
<strings>
	<string key="Description.Foo">Here goes description of foo</string>
</strings>


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org