Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?xml version="1.0" encoding="utf-8" ?>
<data>
<vcard>
<entry id="98">
<forename handle="forrest">Forrest</forename>
<surname handle="gump">Gump</surname>
<work-phone>(111) 555-1212</work-phone>
<primary-email>forrestgump@example.com</primary-email>
<title handle="shrimp-man">Shrimp Man</title>
</entry>
</vcard>
</data>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" media-type="text/vcard" encoding="utf-8"/>
<xsl:template match="/data/vcard/entry">
BEGIN:VCARD
VERSION:3.0
N:<xsl:value-of select="forename"/>;<xsl:value-of select="surname"/>
FN:<xsl:value-of select="surname"/> <xsl:value-of select="forename"/>
TITLE:<xsl:value-of select="title"/>
TEL;TYPE=WORK,VOICE:<xsl:value-of select="work-phone"/>
EMAIL;TYPE=PREF,INTERNET:<xsl:value-of select="primary-email"/>
REV:2008-04-24T19:52:43Z
END:VCARD
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment