You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by St...@avinci.de on 2002/12/02 18:13:46 UTC

Transformation result affected by kind of I/O-Source?

Hi,
 
i tried different ways to transform a xml with a xsl. After parsing the xsl i did the following:
 
Transform:
 
1. transformer.transform(new DOMSource(...), new DOMResult(...))
2. transformer.transform(new StreamSource(...), new StreamResult(...))
3. transformer.transform(new DOMSource(...), new StreamResult(...))
4. transformer.transform(new StreamSource(...), new DOMResult(...))
 
All transformations worked without Exceptions and generated html.
2 & 4 produced the correct result (html code):  
COMP_SHORT_NAME (COMP_KEY)
1 & 3 failed with (values missing):
 ()
 
Stylesheet:
<xsl:include xml:link="include" href = "../templates/parameters.xslt"/>

...

<xsl:value-of select="COMPANY_LIST/COMPANY[@id=$company]/COMPANY_NAME[@language=$language]/SHORTNAME" />&#160;

<xsl:value-of select="concat(' (',$company,')')" />

<xsl:apply-templates select = "COMPANY_LIST" />

The parameters $language and $company are defined in the included stylesheet "parameters.xslt":
<xsl:param name = "company"><xsl:apply-templates select = "*/PARAMETERS/PARAMETER[@name='company']/@value" /></xsl:param>

<xsl:param name = "language"><xsl:apply-templates select = "*/PARAMETERS/PARAMETER[@name='language']/@value" /></xsl:param>

Does anyone know why this happens ?

The Document to be transformed contains an element to be transformed into html and a Parameter element to be used. Is the sequence of those blocks important ? Why &#160; instead of &nbsp; ? (I'm new to XSL and and have to understand / improve those [very slow] stylesheets. Performance hints are welcome :-) )

Btw. I used javax.xml.transform.TransformerFactory and xalan.jar 2.4.1 &  xercesImpl.jar + xml-apis.jar 2.2.0. One single Transformation in a standalone Test-Application, no concurrent Threads.

Stefan

 

Re: Transformation result affected by kind of I/O-Source?

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Remember, this is XML, so &nbsp; isn't defined by default; you must 
provide a Doctype (internal subset or DTD file) which defines it, or it 
has no meaning. The numeric character reference, on the other hand, does 
not require definition since it explicitly refers to the correct Unicode 
character.

______________________________________
Joe Kesselman  / IBM Research