Skip to content

Instantly share code, notes, and snippets.

@lindenb
Created January 22, 2023 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindenb/316aab24e7f9695256dcd2c40986c460 to your computer and use it in GitHub Desktop.
Save lindenb/316aab24e7f9695256dcd2c40986c460 to your computer and use it in GitHub Desktop.
How to get names and class information from a list of target IDs from the JASPAR database? https://www.biostars.org/p/9551867/
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//h3[text()='Profile summary']" />
</xsl:template>
<xsl:template match="h3">
<xsl:apply-templates select="../../div/table" />
</xsl:template>
<xsl:template match="table">
<xsl:value-of select="normalize-space(tr[normalize-space(td[1])='Matrix ID:']/td[2]/text())"/>
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(tr[normalize-space(td[1])='Name:']/td[2]/text())"/>
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(tr[normalize-space(td[1])='Class:']/td[2]/text())"/>
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(tr[normalize-space(td[1])='Family:']/td[2]/text())"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment