I have the following XML:
<core:renderedItem>
<span class="harvard_title">Whose Ecosystem is it Anyway: Private and Public Rights under New Approaches to Biodiversity Conservation</span>
'
<span>
<em>Journal of Human Rights and the Environment</em>
</span>
.
</div>
How do I get access to the text of span class="harvard_title" using xslt? Ideally I would like to return just the text up to the colon "Whose Ecosystem is it Anyway"
Assuming this xml (the one you posted is not well formed):
You can get the text you want with this xsl code:
Whith this:
span[@class = 'harvard_title']
you get the text inside the span, and withsubstring-before
function you get just the text before de colon.Hope it helps.
Edit: you can use an
if
to take into account the case where there is not a colon in the text, but you can do it using templates: