XSLT understands the process of working with the generation identifier

In addition to this xslt link, return the selection of the following siblings. I just want to find out here what the purpose of this is generate-idand how it makes sense in this conformance protocol.

<xsl:for-each select="/items/item[@lcn='005417714']">
  <xsl:for-each select="following-sibling::*[generate-id(preceding-sibling::item[@lcn != ''][1]) = generate-id(current())]">
  </xsl:for-each>
</xsl:for-each>

Any idea, shared resource.

+4
source share
1 answer

The specification generate-idis that it will always return the same identifier for the same node and different identifiers for different nodes. So comparing the values โ€‹โ€‹of generate-idtwo nodes is how you check to see if they are the same node, not just for two nodes that have the same value.

current() " " node - current() ., . node , current() " .".

following-sibling::*[generate-id(preceding-sibling::item[@lcn != ''][1])
                      = generate-id(current())]

node - item (, for-each). , item :

following-sibling::*                      --- all the following sibling elements
 [                                        --- such that
  generate-id(                            --- the identity of
   preceding-sibling::item[@lcn != ''][1] --- that element nearest preceding
                                              item with a non-empty lcn attribute
  )
  =                                       --- is the same as
  generate-id(current())                  --- the identity of the item we started
                                              with
 ]

, <item lcn="005417714"> () <item lcn="anything-non-empty"> ().

:

<item id="00100687" label="A/161i r" lcn="005417714" notes="A/161-182"/>
<item id="00100688" label="A/161i v" lcn="" notes=""/>
<item id="00100819" label="A/182ii v" lcn="" notes=""/>
<item id="00100820" label="A/182iii r" lcn="" notes=""/>
<item id="00100821" label="A/182iii v" lcn="" notes=""/>
<item id="00100822" label="A/183i r" lcn="005417715" notes="A/183-218"/>
<item id="00100823" label="A/183i v" lcn="" notes=""/>
<item id="00100975" label="A/216iii r" lcn="" notes=""/>

node item id="00100687", 00100688, 00100819, 00100820, 00100821 00100822. 00100822,

following-sibling::*[@lcn = '']
                    [generate-id(preceding-sibling::item[@lcn != ''][1])
                      = generate-id(current())]
+10

All Articles