密钥generate-id是什么(previous-sibling :: ...意思是XSL 1.0

时间:2011-01-31 15:42:21

标签: xml xslt xpath

我有以下xsl :

<xsl:key name="kEventslegal" 
         match="HISTORY_EVENT"
         use="concat(generate-id(
                        preceding-sibling::HISTORY_EVENT[
                           @Name='Item Acceptance Review event NO by Legal'
                        ][last()]
                     ),
                     '+',
                     generate-id(
                        following-sibling::HISTORY_EVENT[
                           @Name='Legal Report done'
                        ][1])
                     )"/>

xml:

<ROOT>
     <HISTORY_EVENT Name="Item Acceptance Review event NO by Legal" 
                    EVENTSUBJECT="Item Acceptance Review event NO by Legal">
          <EVENT_TIMESTAMP>31/01/2011 11:08:27</EVENT_TIMESTAMP>
          <EVENT_STATE>opend</EVENT_STATE>
          <EVENT_ROLE>Legal Unit Specialist</EVENT_ROLE>
          <EVENT_USER>legal.test</EVENT_USER>
          <EVENT_TYPE>normal</EVENT_TYPE>
          <EVENT_PROCESS>Item Acceptance Review event NO by Legal Unit Specialist</EVENT_PROCESS>
          <EVENT_MESSAGE>Item Acceptance Review event NO by Legal Unit Specialist legal.test</EVENT_MESSAGE>
        </HISTORY_EVENT>
........
</ROOT>

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

<xsl:key>标识由两个特定HISTORY_EVENT元素包围的所有HISTORY_EVENT元素:

  • 第一个 - 具有Name属性且值为'Item Acceptance Review event NO by Legal'

  • 最后一项 - 具有值Name的{​​{1}}属性:'Legal Report done'

总结:看起来像所有法律报告的所有条目,审核结果为NO。