mep2foaf.xslt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. http://www.w3.org/TR/xslt/
  4. -->
  5. <xsl:stylesheet
  6. xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  7. xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  8. xmlns:dctype="http://purl.org/dc/dcmitype/"
  9. xmlns:dct="http://purl.org/dc/terms/"
  10. xmlns:foaf="http://xmlns.com/foaf/0.1/"
  11. xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
  12. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:xlink="http://www.w3.org/1999/xlink"
  14. version="1.0">
  15. <xsl:output method="xml" indent="yes"/>
  16. <xsl:param name="mep_id_url"></xsl:param>
  17. <xsl:param name="language"></xsl:param>
  18. <xsl:template match="/">
  19. <rdf:RDF>
  20. <xsl:for-each select=".//ul[@class = 'link_collection_noborder']">
  21. <foaf:Person rdf:about="{$mep_id_url}">
  22. <xsl:for-each select=".//a[@id = 'email-0']">
  23. <xsl:variable name="url" select="concat('mailto:', normalize-space(substring-after(@href, 'mailto:')))"/>
  24. <foaf:email rdf:resource="{$url}"/>
  25. </xsl:for-each>
  26. <xsl:for-each select=".//a[@class = 'link_website']">
  27. <foaf:homepage rdf:resource="{normalize-space(@href)}"/>
  28. </xsl:for-each>
  29. </foaf:Person>
  30. <xsl:for-each select=".//a[@class = 'link_fb']">
  31. <xsl:variable name="url" select="concat('http', normalize-space(substring-after(@href, 'http')))"/>
  32. <foaf:Person rdf:about="{$mep_id_url}">
  33. <foaf:online rdf:resource="{$url}"/>
  34. </foaf:Person>
  35. <foaf:OnlineAccount rdf:about="{$url}">
  36. <foaf:accountServiceHomepage rdf:resource="https://facebook.com/"/>
  37. </foaf:OnlineAccount>
  38. </xsl:for-each>
  39. <xsl:for-each select=".//a[@class = 'link_twitt']">
  40. <xsl:variable name="url" select="concat('http', normalize-space(substring-after(@href, 'http')))"/>
  41. <foaf:Person rdf:about="{$mep_id_url}">
  42. <foaf:online rdf:resource="{$url}"/>
  43. </foaf:Person>
  44. <foaf:OnlineAccount rdf:about="{$url}">
  45. <foaf:accountServiceHomepage rdf:resource="https://twitter.com/"/>
  46. </foaf:OnlineAccount>
  47. </xsl:for-each>
  48. </xsl:for-each>
  49. <foaf:Person rdf:about="{$mep_id_url}">
  50. <xsl:for-each select=".//span[@class = 'phone']">
  51. <foaf:phone rdf:resource="tel:{translate(normalize-space(.), ' ', '-')}"/>
  52. </xsl:for-each>
  53. <xsl:for-each select=".//span[@class = 'more_info' and starts-with(normalize-space(.), 'geboren') ]">
  54. <foaf:birthday><xsl:value-of select="normalize-space(substring-before(substring-after(., 'geboren am'), ','))"/></foaf:birthday>
  55. <dct:spatial><xsl:value-of select="normalize-space(substring-after(., ','))"/></dct:spatial>
  56. </xsl:for-each>
  57. </foaf:Person>
  58. </rdf:RDF>
  59. </xsl:template>
  60. </xsl:stylesheet>