nepf
nepf

Reputation: 3

xsl:value-of select= ... <url type="html">

my XML has this

<mailing>
<send-date><![CDATA[2016-05-03 07:08:05]]></send-date>
<subject><![CDATA[My sbjekt]]></subject>
<url type="text"><![CDATA[http://mytextlink]]></url>
<url type="html"><![CDATA[http://myhtmllink]]></url>
<url type="pdf"><![CDATA[http://mypdflink]]></url>
</mailing>

I only want to select the

<url type="html"><![CDATA[http://myhtmllink]]></url>

What ist the right XSLT-Syntax?

Upvotes: 0

Views: 415

Answers (1)

Tim C
Tim C

Reputation: 70598

I think the syntax you are looking for is this...

'<xsl:value-of select="url[@type='html']" />`

So, this selects the url element, with the condition that its type attribute equals "html".

This assumes you are currently positioned on the mailing element. If not, you can do this, which will work whatever your context

'<xsl:value-of select="/mailing/url[@type='html']" />`

Upvotes: 1

Related Questions