This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Preceding: can't filter my nodes?


Hi, 

I'm trying to get a unique set of nodes. I can't seem to tie the preceding
axis to a filter on a given ID. I have tried filtering that node set into a
variable and then getting a unique list from that, but I am still operating
on the whole node set.(abbreviated XML below)

<xsl:variable name="ats" select="/ROWSET/ROW[R_ID='14144']"/>
<xsl:for-each select="$ats/AT_ID[not(.=preceding::AT_ID)]">
  <at_id><xsl:value-of select="."/></at_id>
</xsl:for-each>

Really I want a node set like this:
//ROW[R_ID='14144'][not(AT_ID=preceding::AT_ID)]

I've tried this and a hundred other combinations, like:
//ROW[not(AT_ID=preceding::AT_ID[parent::R_ID='14144'])]

What I thought was that the //ROW[R_ID='14144']would give a node set with
just this ID and then the preceding would be applied against it. However the
preceding seems to be against all nodes. The desired result is:
<at_id>2</at_id><at_id>5</at_id>
However I think the "5" gets knocked out by a "5" in a node that has
R_ID='3107'.

I am using Saxon & OraXSL.

If you can help me please let me know what's going on, I obviously haven't
quite got my head round this yet.

Thanks in advance
Lee

<?xml version = '1.0'?>
<ROWSET>
   <ROW num="1">
      <H_ID>2001</H_ID>
      <TITLE>Get them out of bed</TITLE>
      <R_ID>3107</R_ID>
      <REF_TEXT>My first reference</REF_TEXT>
      <R_ORDER>1</R_ORDER>
      <AT_ID>1</AT_ID>
 
<R_URL>http://archpedi.ama-assn.org/issues/v153n10/abs/poa8425.html</R_URL>
      <NAME>Medicine</NAME>
      <TEXT>Abstract</TEXT>
      <TYPE>ABST</TYPE>
      <SP_TEXT>Microbiology</SP_TEXT>
   </ROW>
   <ROW num="2">
      <H_ID>2001</H_ID>
      <TITLE>Get them out of bed</TITLE>
      <R_ID>3107</R_ID>
      <REF_TEXT>My first reference</REF_TEXT>
      <R_ORDER>1</R_ORDER>
      <AT_ID>3</AT_ID>
 
<R_URL>http://archpedi.ama-assn.org/issues/v153n10/full/poa8425.html</R_URL>
      <NAME>Medicine</NAME>
      <TEXT>Fulltext</TEXT>
      <TYPE>FULL</TYPE>
      <SP_TEXT>Microbiology</SP_TEXT>
   </ROW>
   <ROW num="3">
      <H_ID>2001</H_ID>
      <TITLE>Get them out of bed</TITLE>
      <R_ID>3107</R_ID>
      <REF_TEXT>My first reference</REF_TEXT>
      <R_ORDER>1</R_ORDER>
      <AT_ID>5</AT_ID>
      <R_URL>http://rubbish.com</R_URL>
      <NAME>Medicine</NAME>
      <TEXT>Fulltext-pay</TEXT>
      <TYPE>FULL</TYPE>
      <SP_TEXT>Microbiology</SP_TEXT>
   </ROW>
   <ROW num="19">
      <H_ID>2001</H_ID>
      <TITLE>Get them out of bed</TITLE>
      <R_ID>14144</R_ID>
      <REF_TEXT>My second reference</REF_TEXT>
      <R_ORDER>2</R_ORDER>
      <AT_ID>2</AT_ID>
 
<R_URL>http://www.sciencemag.org/cgi/content/abstract/289/5484/1550</R_URL>
      <NAME>Medicine</NAME>
      <TEXT>Abstract-reg</TEXT>
      <TYPE>ABST</TYPE>
      <SP_TEXT>Microbiology</SP_TEXT>
   </ROW>
   <ROW num="20">
      <H_ID>2001</H_ID>
      <TITLE>Get them out of bed</TITLE>
      <R_ID>14144</R_ID>
      <REF_TEXT>My second reference</REF_TEXT>
      <R_ORDER>2</R_ORDER>
      <AT_ID>5</AT_ID>
 
<R_URL>http://www.sciencemag.org/cgi/content/full/289/5484/1550</R_URL>
      <NAME>Medicine</NAME>
      <TEXT>Fulltext-pay</TEXT>
      <TYPE>FULL</TYPE>
      <SP_TEXT>Microbiology</SP_TEXT>
   </ROW>
</ROWSET>

  


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]