smandape Posted January 23, 2011 Share Posted January 23, 2011 Hello Seniors,well, here is something I am trying to do with the XML code below:I need your help <Gene-commentary_type value="comment">254</Gene-commentary_type> <Gene-commentary_heading>Pathways</Gene-commentary_heading> <Gene-commentary_comment> <Gene-commentary> <Gene-commentary_type value="comment">254</Gene-commentary_type> <Gene-commentary_text>KEGG pathway: Melanogenesis</Gene-commentary_text> I want to extract the <Gene-commentary_text> after the ':',ie, i just want 'Melanogenesis'.I used the following XSLT code: <field name="Pathways"><xsl:for-each select="Entrezgene_comments/Gene-commentary[string(Gene-commentary_heading)='Pathways']/Gene-commentary_comment/Gene-commentary"> <field name="Pathway_name"><xsl:value-of select="Gene-commentary_text[substring-after(text(),':')]"/> </field></xsl:for-each> </field>I also tried <field name="Pathway_name"><xsl:value-of select="Gene-commentary_text[substring-after(.,':')]"/> Thank you for your help..Thank you,Sammed Link to comment Share on other sites More sharing options...
boen_robot Posted January 23, 2011 Share Posted January 23, 2011 A predicate is a lot like an if - you're saying "get the whole thing if this thing is true".Instead, you want to get a part of a thing. So, instead of <field name="Pathway_name"><xsl:value-of select="Gene-commentary_text[substring-after(text(),':')]"/> </field> Try <field name="Pathway_name"><xsl:value-of select="substring-after(Gene-commentary_text,':')"/> </field> Link to comment Share on other sites More sharing options...
smandape Posted January 23, 2011 Author Share Posted January 23, 2011 Thank you for your reply Boen_robot.Thank you,Sammed Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.