Design problem - print header information only if some
Hi, I have an input XML source as the following: .... <Header> .... <!-- could have multiple detail information. --> <Detail>..<Detail> </Header> I need to output the content of the Header ONLY IF certain information exists in the detail. (Let us called this as the satisfied Detail). Besides, each satisfied Detail needed to print out after the Header. The design forces also includes that the testing condition may grow complex in the future. I guess that I have two ways in solving this; however, none of the solution I come up with is not a good solution. <1> Pass the document to one XSL for filtering out the 'unsatisfied' Detail. Then pass the filtered XML to the XSLT again for output. ==>Disadvantage - the performance. <2> Use <xsl:for-each > to select the satisfied Detail node. ==>Disadvantage: If the condition grows complex, I am not sure whether the select attribute within the <xsl:for-each> can fulfill the needs. In addition, If there are multiple detail, how I can print the Detail element once only within the <xsl:for-each> body? (The only solution for this I can see is have two <xsl:for-each>. The first one is check there is any Detail satisfied. If yes, print the header information. Then the second print out the detail. ) Thanks in advance!! Ming-tzung Dung XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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