954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

minute problem about extracting elements

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

smandape
Newbie Poster
24 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 
<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>
xml_looser
Junior Poster
179 posts since Apr 2009
Reputation Points: 16
Solved Threads: 21
 

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

smandape
Newbie Poster
24 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You