[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 11:39:50 +0200
Re:  XML transformation based on parameters
> If your code isn't working and you want to know why, it's usually best to
> show us your code.
>

Thanks! It's here:

<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:nodeset($params)/query-params/param/@name">
      <xsl:value-of
select="xalan:nodeset($params)/query-params/param[@name=current()/@name]/@value"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>

 </xsl:template>

</xsl:stylesheet>

------------

Tried with and without xalan:nodeset extension. The result is the
same: It fails with the following exception:

java.lang.RuntimeException: Invalid conversion from node-set' a
'org.apache.xmlbeans.impl.store.Xobj$DocumentXobj.
	at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:1496)
	at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:1504)
	at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.nodesetF(BasisLibrary.java:499)
	at EmbedParametersFromUri.template$dot$1()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.template$dot$0()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.template$dot$0()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.template$dot$0()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.template$dot$0()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.applyTemplates()
	at EmbedParametersFromUri.transform()
	at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:602)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:710)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
	at com.bea.wli.sb.resources.xslt.XsltExecutor.execute(XsltExecutor.java:153)

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.