|
[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
Hi,
At 01:01 PM 7/3/2005, it was written: You could use keys to identify the elements to output. Thus, your input: Could the requirements here be restated please? If I am not mistaken, the code posted, given this document as input, effectively copies those children of the document element ('root') that do not have exactly three children ... because (again, given the input) the expression count(key('kElems', .)) will always return 3. This is because the value returned by "." is an empty string "" (notice whitespace is being stripped), which happens to be the value of all element children ("*") of all elements matching the key ("/*/*"). I find it hard to believe that's what was wanted. Guessing from the posted subject line, I think the best approach is rather something like <xsl:template match="/*/*">
<xsl:if test="*[count(../*[name()=name(current())]) > 1]">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>This says "copy an element child of the document element if it has any children whose parent has more than one element with the same name as the child".... Note: not tested. Cheers, Wendell
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. 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
|







