Subject: RE: [xsl] Preceding axis conumdrum From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 25 Aug 2006 20:53:00 +0100 |
> The expression I am trying to use to select that value is: > > Preceding-sibling::row/cell[@columnHeader='ItemDate'][not(stri ng-length( > normalize-space(.))=0)][1] Try (preceding-sibling::row/cell[@columnHeader='ItemDate'][not(string-length(nor malize-space(.))=0)])[last()] or more concisely (preceding-sibling::row/cell[@columnHeader='ItemDate'][normalize-space(.)])[ last()] The predicate [1] only gives you the last in document order if it's applied immediately to a reverse axis. You're applying it to the child axis, so what you asked for is: for all the preceding-sibling rows select the child cells that have a columnHeader of "ItemDate" that aren't empty and if there's more than one such child, select the first That will potentially select one cell in each row, and if you use this in xsl:value-of in XSLT 1.0 this will discard all but the first. Michael Kay http://www.saxonica.com/ > > Maybe I'm misunderstanding the axis, but I really can't > understand why this doesn't work. In this case I seem to get > '7 May' rather than what I want '11 May'. I'm using Saxon8.0 > to process this. Have I found a bug? > > > <row rowNumber="2"> > <cell > columnHeader="ItemCost">0.341</cell> > <cell > columnHeader="ItemDuration">40:02</cell> > <cell > columnHeader="ItemDestination">National</cell> > <cell > columnHeader="ItemNoDialled">01415871046</cell> > <cell > columnHeader="ItemTime">18:50</cell> > <cell > columnHeader="ItemDate">7 May</cell> > </row> > <row rowNumber="3"> > <cell > columnHeader="ItemCost">0.389</cell> > <cell > columnHeader="ItemDuration">45:39</cell> > <cell > columnHeader="ItemDestination">Local</cell> > <cell > columnHeader="ItemNoDialled">01294272776</cell> > <cell > columnHeader="ItemTime">19.31</cell> > <cell > columnHeader="ItemDate">11 May</cell> > </row> > <row rowNumber="4"> > <cell > columnHeader="ItemCost">0.172</cell> > <cell > columnHeader="ItemDuration">8:25</cell> > <cell > columnHeader="ItemDestination">Local</cell> > <cell > columnHeader="ItemNoDialled">01294217616</cell> > <cell > columnHeader="ItemTime">08:54</cell> > <cell > columnHeader="ItemDate"></cell> > </row> > <row rowNumber="5"> > <cell > columnHeader="ItemCost">0.237</cell> > <cell > columnHeader="ItemDuration">3:42</cell> > <cell > columnHeader="ItemDestination">National Rate Call</cell> > <cell > columnHeader="ItemNoDialled">08706099000</cell> > <cell > columnHeader="ItemTime">13:53</cell> > <cell > columnHeader="ItemDate"/> > </row> > > Many thanks, > Ed
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Preceding axis conumdrum, Ed Yau | Thread | RE: [xsl] Preceding axis conumdrum, Wendell Piez |
[xsl] Preceding axis conumdrum, Ed Yau | Date | [xsl] Using translate() for single , Oleg Konovalov |
Month |