Hello Seniors,
I am trying to extract an element from a string using the delimiter ';' in case it is in the middle of the string or nothing if it is the only element in the string..i am coding a generalized code that can extract the element from any such kind of file...the XML code is as follows

<GBSeq_comment>On or before Feb 16, 2007 this sequence version replaced gi:121945493, gi:121751.; [FUNCTION] Facilitative glucose transporter. This isoform may be responsible for constitutive or basal glucose uptake. Has a very broad substrate specificity; can transport a wide range of aldoses including both pentoses and hexoses.; [SUBCELLULAR LOCATION] Cell membrane; Multi-pass membrane protein (By similarity).;[TISSUE SPECIFICITY]Lungs.</GBSeq_comment>

or it may be like this

<GBSeq_comment>[FUNCTION] Facilitative glucose transporter. This isoform may be responsible for constitutive or basal glucose uptake. Has a very broad substrate specificity; can transport a wide range of aldoses including both pentoses and hexoses.</GBSeq_comment>

i know the code when the XML code is

<GBSeq_comment>On or before Jun 16, 2010 this sequence version replaced gi:74751531, gi:17367002.; [FUNCTION] Insulin-regulated facilitative glucose transporter. Binds cytochalasin B in a glucose-inhibitable manner. Seems to be a dual-specific sugar transporter as it is inhibitable by fructose (By similarity).; [SUBUNIT] Interacts</GBSeq_comment>

i tried using the function tokenize()(Thanks John for helping)..also tried substring-before and after..i get the output for the codes that just end with the delimiter ';' or if it is the only thing in the string, but when the delimiter is also included in the element to extract,it gives me only half of it.

could you please help me...
i greatly appreciate your help and thank you for your time..

thank you,
sammed

<xsl:template match="GBSeq_comment">
		<xsl:choose>
			<xsl:when test="contains(.,'; [FUNCTION] ') and contains(.,'; [SUB')">
				<xsl:value-of select="substring-before(substring-after(.,'; [FUNCTION] '),'; [SUB')"/>
			</xsl:when>
			<xsl:when test="contains(.,'[FUNCTION] ')">
				<xsl:value-of select="substring-after(.,'[FUNCTION] ')"/>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

Thanks a lot...i didn't think of this..i got it..Thank you
Sammed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.