xsl-list
[Top] [All Lists]

RE: [xsl] XML transformation based on parameters

2009-04-16 06:03:46
I would suggest that you ask about this on a Xalan-specific list. The types
of object that are accepted as external parameters depend on the processor.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Emiliano Pecis [mailto:emiliano(_dot_)pecis(_at_)gmail(_dot_)com] 
Sent: 16 April 2009 10:40
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] 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[(_at_)name=curren
t()/@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.r
unTimeError(BasisLibrary.java:1496)
      at 
com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.r
unTimeError(BasisLibrary.java:1504)
      at 
com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.n
odesetF(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.AbstractTransl
et.transform(AbstractTranslet.java:602)
      at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.t
ransform(TransformerImpl.java:710)
      at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.t
ransform(TransformerImpl.java:313)
      at 
com.bea.wli.sb.resources.xslt.XsltExecutor.execute(XsltExecuto
r.java:153)

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>