[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: only display if subnodes occur more than once
Aron,
Thanks. Of course the solution I posted doesn't work either, due to limitations of XPath 1.0 and the fact that current() refers not to any node being predicated, but to the current node (the node matched). Quite an interesting problem, actually. It should be pretty straightforward in XPath 2.0, but the only XSLT 1.0 solutions I've thought of are very ugly and un-XSLTish. That may be unavoidable, again due to limitations in XPath 1.0 -- but before posting one of those I thought I'd give time to see if others can work it out more elegantly.... Anyone? Oh heck, here's an ugly solution: <xsl:template match="root/*"> <xsl:variable name="include"> <xsl:call-template name="include"/> </xsl:variable> <xsl:if test="string($include)"> <xsl:copy-of select="."/> </xsl:if> </xsl:template> <xsl:template name="include"> <xsl:for-each select="*"> <xsl:if test="following-sibling::*[name()=name(current())]">X</xsl:if> </xsl:for-each> </xsl:template> It uses a template to fake a function, which returns a null value (which fails the string() test) if there are no children that have following siblings of the same name. Cheers, Wendell At 03:35 PM 7/5/2005, you wrote: The original problem asked (I think), given: ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|