From: <rom...@ya...> - 2007-07-11 09:18:52
|
Danuvius, I am not familiar with DOM on xpath, but when you use parent:: backlink, you take the option to work with children reference. Why not using person and family templates ? Family : father+mother+children On person child-node, you have the family status ... <childof ref="Fxxxx"/> child of Fxxxx <parentin ref="Fzzzz"/> parent in Fzzzz You have choice for test: person/parentin ref = person/childof ref = same family person/parentin ref = family id person/childof ref = family id Maybe using "following::" or "preceding::" will not fix your problem. For me, you do not need to search chidref on family. Instead of working on Person you may do this on Family and try to find person id with your parent:: backlink. HTH Danuvius a écrit : > I am trying to work with Gramps XML by means of XSLT. I am trying to > select all children of a person (i.e.: all children who are referenced > from families in which the person is either "father" or "mother"). > The below code does this just fine... however I am finding eliminating > duplicates from the list to be an impossible task: > > <xsl:for-each select="key('familymember-by-hlink', > $person/@handle)[name() = 'father' or name() = > 'mother']/parent::gramps:family/gramps:childref[not(count(@hlink[. = > following::gramps:childref/@hlink]) > 1)]"> > > The above code leaves in duplicates caused by one person being listed > as a child in more than one families the person (i.e.: $person) is > mother or father in. ('familymember-by-hlink' matches all child > elements of "family" elements whose hlink attributes match the > specified value) > > Changing (in the last part) "following::" to "preceding::" *appears* > to work... but appears to also remove some non-duplicate entries. > (The "non-duplicate" entry being removed is the same person that shows > up twice with "following::", but is only erroneously remove from one > of the parents.) > > Is there anything obvious fundamentally wrong with my xpath up there? > Just kind of hoping the answer is yes, and I can stop wrecking my > brain over this. > > Thank you in advance! |