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 "Edward L. Knoll" <ed...@cosd.fedex.com> on 2004/09/10 21:58:30 UTC

Solciting feedback on solution approach.

based on subsequent user selections I'm looking for alternate (and
general) solution approaches to a problem we're solving.  We have
something that's working, but are not happy with the performance.   I
may be able to tune the performance to an acceptable level, but I want
to make sure that there aren't fundamentally different ways for us to
approach this problem which might be better before embarking down the
optimization path.

At the highest level, we're generating HTML from XML.  We have a highly
encoded input source with more content than we usually present.   We
translate the input XML into an intermediate XML in which a subset of
the input elements have been transformed for human consumption.   The
intermediate XML is generated, because we potentially generate several
different HTML outputs from the same intermediate XML.

There's a finite number of unique transformations applied to much larger
set of elements.  For maintenance reasons, we've elected to maintain the
mapping of transformations to element names in an XML file: the fields
names are elements, the type of transformation is an attribute (the
transformations themselves are represented by specific xsl:templates).
This transformation map is loaded into a node-set in our
raw-to-intermediate XSL stylesheet.   As we process input elements, we
look for their name in the transformation map; if found, the specified
transformation is applied to the element.

Most of the transformations to be done are actually simple table look
ups to map codes to display values.  There are several of these
translation maps.  These translation maps are maintained in XML (a
separate file for each map, again for maintenance reasons).   These maps
are loaded into node-sets in our raw-to-intermediate XSL stylesheet.
The transformation specification will indicate which map is to be used
in the transformation of a specific field.

Here's an example of the transformation map:

<Transforms>
   <base-service-cd  type='code'  map='ServiceType'  toField='Acronym' />
</Transforms>

Here's an example of a translation map:

<Map name='ServiceType'>
   <Item>
      <Code>...</Code>
      <Acronym>...</Acronym>
   </Item>
</Map>

We load the transformation map and translation maps using the following:

<xsl:variable  name="Transforms"
               select='document("Transforms.xml")/Transforms' />

<xsl:variable  name="Maps"

select="document(document('MapList.xml')/MapList/File)/Map" />


There's a couple of things which are bothering me with this approach:

1) Looking up elements in our transformation MAP seems to take an
inordinate amount of time.  Here's an example of how we look for the
transformation for specific element:

   <xsl:variable name='elementName' select='local-name()' />
   <xsl:variable name='TransformSpec'
select='$Transforms/*[local-name()=$elementName]' />

2) While we are preloading our XSL stylesheets into a Templates object,
I believe the variables into which we load the transformation map and
the translation maps are being redetermined every time we create a
Transformer and/or execute Transformer.transform().

NOTE: At this time, the translation mapping (of codes to display values)
does not appear to major contributor to our performance.

(Most) Feedback would be appreciated.

Regards,
Ed Knoll

-- 
Edward L. Knoll   Phone (FedEx)     : (719)484-2717
                   e-mail (FedEx)    : edward.knoll@fedex.com
                   e-mail (personal) : edward@elknoll.com