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. > ________________________________________________________________________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format