[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML transformation based on parameters

Subject: Re: XML transformation based on parameters
From: Emiliano Pecis <emiliano.pecis@xxxxxxxxx>
Date: Thu, 16 Apr 2009 15:32:46 +0200
Re:  XML transformation based on parameters
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[@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@xxxxxxxxx>:
>
>> 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.
> ________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.