Subject: Re: [xsl] How to take a node set and convert it into a table view From: "Sam Carleton" <scarleton@xxxxxxxxxxxxxxxx> Date: Tue, 12 Dec 2006 10:35:05 -0500 |
I fear that you will need to try to make a small input example and a small output example. Perhaps someone could glean more information from your description than I could, but I wouldn't be able to suggest any code just from the description so far, sorry.
this is going to be interesting, for there is no way to really give you a full picture without post many lines of XML. The best I can figure it give you a small part of one of the main nodes being process, but none of the nodes that is the actual source of the info...
<Report> <methods> <Method/> </methods> <cals> <Cal/> </cals> <blanks> <Blank/> </blanks> <StdCollection/> <schedule> <schGrps> <schGrp stdOID="400829e4-47eb-49c5-8caa-9a16c1745b13"> <schLine position="1"> <metadata> <blankDoc version="2" revision="0">c9df660e-9aeb-45c9-9676-9580ec7c3e8d</blankDoc> <methodDoc version="1" revision="0">9a928d31-2320-4d67-af3b-bf5f16a7eb7b</methodDoc> <calDoc version="1" revision="0">e6f42bb1-a8d2-4277-a773-32a25d730fd6</calDoc> <stdDetailLineOID>c170cafc-e2e2-47e7-8c14-9747e6f3c1f0</stdDetailLineOID> <dilution>0</dilution> </metadata> </schLine> </schGrp> </schGrps> </schedule> <electronicSignatures/> </Report>
<xsl:key name="Method" match="/Report/methods/Method" use="concat(@objectID,'/',@version)"/> <xsl:key name="Cal" match="/Report/cals/Cal" use="concat(@objectID,'/',@version,'/',@revision)"/> <xsl:key name="Blank" match="/Report/blanks/Blank" use="concat(@objectID,'/',@version,'/',@revision)"/> <xsl:key name="StdItem" match="/Report/StdCollection/standardLines/standardLine" use="objectID"/> <xsl:key name="DetailLine" match="/Report/StdCollection/standardLines/standardLine/detailLines/detailLine" use="objectID"/>
<xsl:template match="schGrp"> <xsl:variable name="method" select="key('Method',concat(schLine[1]/metadata/methodDoc,'/',schLine[1]/metadata/methodDoc/@version))"/> <xsl:variable name="calSummaryInfo" select="key('Cal',concat(schLine[1]/metadata/calDoc,'/',schLine[1]/metadata/calDoc/@version,'/',schLine[1]/metadata/calDoc/@revision))/calSummaryInfo"/>
<table border="1"> <tr> <td style="width: 20%"> Dilution: <xsl:value-of select="$method/analysisBasicTypes/analysisBasicType/parameter[@paramName='Dilution']"/> </td> <td style="width: 20%"> Blank Contribution: <xsl:value-of select="schLine[1]/replicateResults/replicateResult[1]/blankContribution"/> </td> <td style="width: 20%"> Method: <xsl:value-of select="$method/methodSummaryInfo/SummaryInfo/name"/> </td> <td style="width: 20%"> Calibration: <xsl:value-of select="$calSummaryInfo/SummaryInfo/name"/> </td> <td style="width: 20%"> <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> </td> </tr> </table>
The real complexity comes in when I have to take into account all the dilution from the group. schLine elements that have the same position, have the same dilution. There can be anywhere from one or more dilutions within a group. The desired output would be a table where the first dilution would be in the fifth column of the table above, and than the next 5 dilutions would be on the next row, etc. Of course, if the schGrp has 10 lines, but only 3 dilutions, we only want to display the three different dilutions.
For example
> So, I am thinking that there has to be some way within XSLT to take a > node set of X nodes and convert it into a table view. Is there?
all input to XSLT is a node set, so this appears to be asking if it's possible to write an XSLT stylesheet that generates an (html?) table to which the answer to such a general question must be yes, but I suspect that wasn't the question you intended to ask?????
<nodes> <node name="a">1</node> <node name="b">2</node> <node name="c">3</node> <node name="d">4</node> <node name="e">5</node> <node name="f">6</node> <node name="g">7</node> <node name="h">8</node> <node name="i">9</node> <node name="j">10</node> </nodes>
a:1 b:2 c:3 d:4 e:5 f:6 g:7 h:8 i:9 j:10
I am thinking that if I can get all the name/values in the first example into a node set like in the second, then all I would have to do is get the second node set into a table of 5 columns with X number of rows.
-- Miltonstreet Photography http://www.miltonstreet.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to take a node set an, David Carlisle | Thread | Re: [xsl] How to take a node set an, David Carlisle |
RE: [xsl] Searching in Sub-children, Houman Khorasani | Date | Re: [xsl] how search end of line in, Florent Georges |
Month |