문제

So my XSL questions seem to have no end.

let us say i have the following xml:

<root>
    <dates>
        <date value="20131214" a="one"></date>
        <date value="20131224" a="two"></date>
    </dates>
</root>

Now what i want is to select the value attribute by the a attribute value, so let's say i want the value of a date where it's a value equals one.

What is the best way to achieve this?

도움이 되었습니까?

해결책

It rather depends on your current context. If you are at the still at the top-level root node ("/"), then:

<xsl:value-of select="root/dates/date[@a='one']/@value"/>

will do.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top