XSL Value-of help

Here should go questions about transforming XML with XSLT and FOP.
blakogre
Posts: 2
Joined: Fri Sep 21, 2007 2:01 am

XSL Value-of help

Post by blakogre »

I have a statement in my XSL sheet:

<xsl:value-of select="general/alert[id='12053']/desc"/>

It returns in the outputted file:

"10.10.10.24 resolves as hostname.domainname.com.<br/>"

I really only want:

"10.10.10.24 resolves as hostname.domainname.com."

Or even "hostname.domainname.com"

Any way to parse/select only that portion? hostname.domainname.com is a variable, obviously, and is different for each IP/host.
jkmyoung
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Post by jkmyoung »

<xsl:value-of select="substring-after(general/alert[id='12053']/desc, 'resolves as ')"/>

I don't think you're getting the <br/> from here. Check the rest of your code.
blakogre
Posts: 2
Joined: Fri Sep 21, 2007 2:01 am

Post by blakogre »

Here's the source XML:

<alert>
<hostname>10.10.10.24</hostname>
<portname>general/tcp</portname>
<id>12053</id>
<level>NOTE</level>
<desc><![CDATA[10.10.10.24 resolves as hostname.domainname.com.<br/>]]></desc>
</alert>
jkmyoung
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Post by jkmyoung »

Is the <br/> always in the code?

<xsl:value-of select="substring-before(general/alert[id='12053']/desc, '<br'"/>
Post Reply