根据另一个元素XSLT读取元素的值

时间:2017-08-02 13:04:54

标签: xslt xslt-1.0

我想阅读标签的名称' name'在标签' id'值得24.所以我想得到" Obuwie damskie"的价值。

<Data>
        <Category>                
            <Category>
                <id>15</id>
                <lft>24</lft>
                <rght>0</rght>
                <parent>24</parent>
                <name>Koturny</name>
                <ger_name>Keilabsatzschuhe</ger_name>
                <eng_name/>
                <slug>koturny</slug>
                <eng_slug>-11</eng_slug>
                <ger_slug>keilabsatzschuhe</ger_slug>
                <ProductsCategory>
                    <id>33969</id>
                    <category_id>15</category_id>
                    <product_id>15676</product_id>
                </ProductsCategory>
            </Category>
            <Category>
                <id>24</id>
                <lft>0</lft>
                <rght>0</rght>
                <parent>0</parent>
                <name>Obuwie damskie</name>
                <ger_name>Damenschuhe</ger_name>
                <eng_name/>
                <slug>obuwie-damskie</slug>
                <eng_slug>-21</eng_slug>
                <ger_slug>damenschuhe</ger_slug>
                <ProductsCategory>
                    <id>33970</id>
                    <category_id>24</category_id>
                    <product_id>15676</product_id>
                </ProductsCategory>
            </Category>
        </Category>
    </Data>

我会请你帮忙,因为我已经整天坐着

1 个答案:

答案 0 :(得分:0)

xsl:value语句中包含的相应XPath表达式为:

<xsl:value-of select="/Data/Category/Category[id='24']/name" />