xsl-list
[Top] [All Lists]

Re: [xsl] XML transformation based on parameters

2009-04-16 09:33:16
Please, don't hate me, but I still have some doubts. I believe to be
close to a solution.
I'm tring to get the xml object as a string parameter, using
xx:evaluate() function.
In this way:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:qp="http://epecis/queryparams";
xmlns:xalan="http://xml.apache.org/xalan";
exclude-result-prefixes="xalan">

 <xsl:param name="params" />

 <xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="*[local-name()='param']">
  <xsl:choose>
    <xsl:when test="@name = xalan:evaluate($params)/query-params/param/@name">
      <xsl:value-of select="
xalan:evaluate($params)/query-params/param[(_at_)name=current()/@name]/@value"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>

 </xsl:template>
</xsl:stylesheet>


In this way the processor fails with the following error:
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: Extra illegal tokens:
'name', '=', '"id"', 'value', '=', '"6SIA-3VUWK"', '/', '>', '<', '/',
'query-params', '>'

What you see are exactly my xml elements passed as a string. I've read
some posts by Michael saying that to fix it with XSLT 1.0, we have to
use a workaround, using a sort of cycle. But I didn't understand how
could I apply it on my code...

Thanks again!!!
e.


2009/4/16 David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>:

in this case what should I do?
you won't need xx:node-set (or the document function) but you will need to
pass the document (as a dom of some sort into xalan as a parameter which
will b epossible but I don't use xalan so I can't tell you the details.


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--