XSLT problem

W

w.tadema

Hello,
I've got the following problem and I wonder wether anyboy could give me
some clues on how to solve it:

The XML source file:
<?xml version="1.0"?>

<MEDEWERKER>

<REGISTRATIENR>111111111</REGISTRATIENR>

<VOORNAAM>Jantje</VOORNAAM>

<ACHTERNAAM>Jansen</ACHTERNAAM>

<VOORLETTERS>J</VOORLETTERS>

<GESLACHT>M</GESLACHT>

<WERKGEVER>BEDRIJF X
<AFDELING>Afdeling A
<CLUSTER NIVEAU="primair">Cluster 1
<FUNCTIE>abcdef</FUNCTIE>
</CLUSTER>

</AFDELING>

<AFDELING>Afdeling B
<CLUSTER NIVEAU="secundair">Cluster 2

<FUNCTIE>fghij</FUNCTIE>
</CLUSTER>

</AFDELING>

</WERKGEVER>

</MEDEWERKER>

I want to select the text-node for AFDELING where the attribute NIVEAU
of CLUSTER equals primair. How should I do that?
So far I've come up with:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v2006 (http://www.altova.com) -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:element name="afdeling">
<xsl:value-of
select="MEDEWERKER/WERKGEVER/AFDELING/text()[CLUSTER/@NIVEAU='primair']"
/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

I also tried:
<xsl:value-of
select="MEDEWERKER/WERKGEVER/AFDELING/text()[PARENT/CLUSTER/@NIVEAU='primair']"
/>

Both solutions did not yield any results. I would appreciate your
suggestions.

Kind regards,

Willy Tadema
 
J

Joseph Kesselman

I want to select the text-node for AFDELING where the attribute NIVEAU
of CLUSTER equals primair. How should I do that?

You were close...

select="MEDEWERKER/WERKGEVER/AFDELING[CLUSTER/@NIVEAU='primair']/text()"
 
W

w.tadema

Thank you Joseph. Just what I needed!

Joseph Kesselman schreef:
I want to select the text-node for AFDELING where the attribute NIVEAU
of CLUSTER equals primair. How should I do that?

You were close...

select="MEDEWERKER/WERKGEVER/AFDELING[CLUSTER/@NIVEAU='primair']/text()"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top