xslt - XSL : how to select a unique nodes in a nodeset -


I'm talking about choosing unique nodes in a separate document (using the Muenchian method), but my In case I can not use the key (or I do not know how) because I'm working on the node set and not on the document.

And the keys can not be set to the node-set, basically I have a variable:

     

which includes & lt; Structure & gt; Elements may be included in the node set: & lt; DeviceInstance & gt; / P> & lt; DeviceInstance name = "Demux TSchannel" means index = "0" & ​​gt; & Lt; Structure Name = "Demysticusnel Caps" & gt; & Lt; / Structure & gt; & Lt; / DeviceInstance & gt; & Lt; DeviceInstance name = "Demux TSchannel" means index = "1" & gt; & Lt; Structure Name = "Demysticusnel Caps" & gt; & Lt; / Structure & gt; & Lt; / DeviceInstance & gt; & Lt; DeviceInstance name = "Demux TSchannel" means index = "3" & gt; & Lt; Structure name = "other caps" & gt; & Lt; / Structure & gt; & Lt; / DeviceInstance & gt;

and let me know & lt; Structure & gt; Do not know to select the elements that have only different names in this example in the selection two and elements:

   
  select = "$ limitedSet // structure [no (@ name = predecessor :: structure / @ name)]"  
/ Code>

But the preceding axis do not accompany all documents, not $ limitSet ?

I'm stuck, someone can help me out, thank you.

  & lt; Xsl: variable name = "structure" = "$ limitedSet // structure" /> & Lt; Xsl: each selection = "$ structure" & gt; & Lt; Xsl: variable name = "name" = "@ name" /> & Lt; Xsl: if test = "generate-id () = generate-id ($ structure [@name = $ name] [1])" & gt; & Lt; Xsl: copy-of select = "." / & Gt; & Lt; / XSL: If & gt; & Lt; / XSL: for-each & gt;  

This can be accessed by a key:

  & lt; Xsl: key name = "kStructureByName" match = "structure" use = "@ name" /> & Lt ;! - ... - & gt; & Lt; Xsl: if test = "generate-id () = generate-id (key ('kStructureByName', $ name) [1])" & gt;  

Depending on your input, the key must obtain some additional relevant information:

  & lt; Xsl: key name = "kStructureByName" match = "structure" usage = "concat (ancestor :: device [1] / @ id, ',', @ name)" /> & Lt ;! - ... - & gt; & Lt; Xsl: variable name = "name" = "concat (ancestor :: device [1] / @ id, ',', @ name)" /> & Lt; Xsl: if test = "generate-id () = generate-id (key ('kStructureByName', $ name) [1])" & gt;  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -