[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Children with the same name
On 21/11/2011 16:34, Merrilees, David wrote:
Hiyour desired output had <array> here? <xsl:apply-templates select="array/node()[name() = name(../node())]" />../node() selects all the children of your parent including yourself, so this would not work even if you modified it to call name(0 on each node sparately. * copies the child elements but your examples only have child text so uou would lose the contents of each item.</test> </xsl:template> your desired result does not have this empty item even though it shares the name "item", is there an additioanl unstated rule that empty elements be filtered, or should this be in the output? <nope/> <item>4</item> <item>5</item> <wibble/> <item>six</item> <wibble>stuff</wibble> <item>item</item> <no/> </array> as with all grouping, this would be easier in xslt2, but assuming you do need 1, something like <xsl:key name="n" match="*" use="concat(generate-id(..),name())"/> select="array/*[key('n',concat(generate-id(..),name())[2]]" /> David Desired output -- google plus: https:/profiles.google.com/d.p.carlisle ________________________________________________________________________ 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
|