Page 1 of 1

XSL Value-of help

Posted: Fri Sep 21, 2007 2:31 am
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.

Posted: Fri Sep 21, 2007 4:39 pm
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.

Posted: Fri Sep 21, 2007 5:12 pm
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>

Posted: Tue Oct 02, 2007 5:11 pm
by jkmyoung
Is the <br/> always in the code?

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