<xsl:apply-templates select="element[child='Yes']">
działa dobrze, ale chciałbym używaćXSLT - mecz zmienny element orzecznika
<xsl:apply-templates select="element[$childElementName='Yes']">
więc mogę użyć zmiennej aby określić węzeł.
Na przykład
<xsl:apply-templates select="theList/entity[Central='Yes']">
działa dobrze przed:
<?xml version="1.0" encoding="utf-8"?>
<theList>
<entity>
<Business-Name>Company 1</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>Yes</Central>
<region1>No</region1>
<region2>Yes</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
<entity>
<Business-Name>Company 2</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>No</Central>
<region1>Yes</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>Yes</Northern>
</entity>
<entity>
<Business-Name>Company 3</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>Yes</Central>
<region1>No</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
<entity>
<Business-Name>Company 4</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>No</Central>
<region1>No</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
</theList>
Ale nie chcą ciężko kodem nazwa elementu dziecko.
Wszelkie sugestie?
Dzięki Tim dla odpowiedź:
<xsl:apply-templates select="theList/entity[child::*[name()=$childElement]='Yes']" />
Would not wybierając jakąkolwiek 'entity' który ma węzeł potomny o wartości 'Tak' osiąga to samo? – Oded
Dobre pytanie (+1). Zobacz moją odpowiedź na bardzo krótkie i proste rozwiązanie. :) –