[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Is there a better way to produce a single html via
Z W wrote:
HiFrom what I understand, you are trying to get the minimum and maximum of a result. This XPath: <xsl:value-of select="document($previousJTL)/Results/*[@label ='Init']/@time" /> Doesn't do that. The easiest (at least to program) way of getting the min and max would be to simply sort the values then get the min/max. This is my example. Turns out the FAQ (http://www.dpawson.co.uk/xsl/sect2/N6461.html#d10052e632) has a similar example. I simplified your case (removed the document), but this is enough to get you started. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:template match="Results"> <xsl:apply-templates select="sampleResult[@label ='Init']" mode="max"> <xsl:sort select="@time" order="descending" data-type="number" /> </xsl:apply-templates> </xsl:template> <xsl:template match="sampleResult" mode="max"> <xsl:if test="position() = 1"> <xsl:value-of select="@time"/> </xsl:if> </xsl:template> </xsl:stylesheet> FYI, thanks to your question I found out how twisted the interaction between position, apply-templates and sort really is. Namely, sorting occurs after the XPath has matched not before. That makes sense when you think about it, but still it is debatable whether this is for the best. It definitely makes this processing more difficult. In one of your other posts, you mention you are using Ant.b) Because of (a), I thought I should make 2 separate calls to the same xls for the 2 xml files, whose outputs are html files But this create the problem to find a way to combine these 2 html files. My recommendation here (if it is still relevant) is to not try and combine two HTML outputs, but combine the inputs. You mentioned using Ant, I would have a two pass process, first pass combines the two files into one, the second parse does whatever you really want to do. I do something similar with XSDs. It shouldn't be too hard to do. As I said, don't know if you need to actually do that.
|
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
|