Guest David Freire Posted June 4, 2007 Share Posted June 4, 2007 Hello everyoneI'm trying to return distinct values from a xml Document using Muenchian way, the problem is that the element i select is dynamic, so i pass a param from the server.The XSLT:<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="Element"/><xsl:key name="distinct-Element" match="//*[name()=$Element]" use="." /><xsl:template match="/"> <xsl:for-each select="//*[name()=$Element][generate-id()=generate-id(key('distinct-Element',.))]"> <xsl:element name="a"> <xsl:attribute name="id">DivPesquisa_<xsl:value-of select="." /></xsl:attribute> <xsl:attribute name="href">#</xsl:attribute> <xsl:attribute name="onclick">SelectTextBoxOnClix('DivPesquisa_<xsl:value-of select="." />')</xsl:attribute> <xsl:attribute name="onmouseover">onMouseOver()</xsl:attribute> <xsl:attribute name="onmouseout">onMouseOut()</xsl:attribute> <xsl:attribute name="onmouseup">onMouseUp("<xsl:value-of select="."/>")</xsl:attribute> </xsl:element> </xsl:for-each> </xsl:template></xsl:stylesheet>It's giving me syntax error on: <xsl:key name="distinct-Element" match="//*[name()=$Element]" use="." /> I'm i using the param the right way?Thanks in advance Link to comment Share on other sites More sharing options...
boen_robot Posted June 4, 2007 Share Posted June 4, 2007 Well, it seems param/variable references are simply not allowed in a key definition. Java's Built-in processor and Saxon 8.9.0.3 however seem to disagree on that. In other words, they do allow this construct, or at least don't throw an error on it that is.What processor do you have? What priviliges do you have? If you use ASP.NET or JSP and have priviliges to install extensions, use Saxon. If not... well... I guess you'll be forced to use DOM or another mean to adjust the value of the key's match attribute. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.