[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-comment] Visit card as QR Code
It looks like either of these would work in DocBook 5.1:
person/address/inlinemediaobject
or
person/personname/inlinemediaobject
Bob Stayton Sagehill Enterprises bobs@sagehill.net
<?xml version='1.0' encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" exclude-result-prefixes="db xlink" version='1.0'> <xsl:output method="text" /> <!-- Written by ntuflorimond@yahoo.com Purpose : turn personal information into vCard format https://tools.ietf.org/html/rfc6350 --> <xsl:template match="db:person|db:author|db:editor" mode="vcard"> <xsl:call-template name="person.vcard" /> </xsl:template> <xsl:template name="person.vcard"> <xsl:text>BEGIN:VCARD</xsl:text> <xsl:text> </xsl:text> <!-- newline character --> <xsl:text>VERSION:4.0</xsl:text> <xsl:text> </xsl:text> <!-- newline character --> <xsl:text>FN:</xsl:text> <xsl:value-of select=".//db:honorific" /> <xsl:text> </xsl:text> <xsl:value-of select=".//db:firstname" /> <xsl:text> </xsl:text> <xsl:value-of select=".//db:surname" /> <xsl:text> </xsl:text> <xsl:value-of select=".//db:lineage" /> <xsl:text> </xsl:text> <!-- newline character --> <xsl:apply-templates mode="vcard" /> <xsl:text>END:VCARD</xsl:text> </xsl:template> <!-- ==================================================================== --> <xsl:template match="db:personname" mode="vcard" > <xsl:text>N:</xsl:text> <xsl:apply-templates select="db:firstname|db:surname|db:othername|db:honorific|db:givenname|db:lineage" mode="vcard" /> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <xsl:template match="db:firstname|db:surname|db:othername|db:honorific|db:givenname|db:lineage" mode="vcard"> <xsl:value-of select="." /> <xsl:if test="not( position() = last())"> <xsl:text>;</xsl:text> </xsl:if> </xsl:template> <xsl:template match="db:othername" mode="vcard"> <xsl:text>NICKNAME:</xsl:text> <xsl:value-of select="." /> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <xsl:template match="db:imagedata" mode="vcard"> <!-- To be implemented : easy if base64 encoded ( I guess) --> <!-- <xsl:text>PHOTO:</xsl:text> --> </xsl:template> <xsl:template match="db:date" mode="vcard"> <xsl:text>BDAY:</xsl:text> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <xsl:template match="db:address" mode="vcard"> <xsl:apply-templates select="db:street|db:otheraddr|db:pob|db:postcode|db:city|db:state|db:country" mode="vcard"/> <xsl:apply-templates select="*[not(self::db:street)][not(self::db:otheraddr)][not(self::db:pob)][not(self::db:postcode)][not(self::db:city)][not(self::db:state)][not(self::db:country)]" mode="vcard"/> </xsl:template> <xsl:template match="db:street|db:otheraddr|db:pob|db:postcode|db:city|db:state|db:country" mode="vcard"> <xsl:if test="1 = position()"> <xsl:text>ADR:</xsl:text> </xsl:if> <xsl:value-of select="string(.)" /> <xsl:choose> <xsl:when test="not( position() = last())"> <xsl:text>;</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> <!-- newline character --> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>LABEL:</xsl:text> </xsl:template> --> <xsl:template match="db:phone" mode="vcard"> <xsl:variable name="spec"> <xsl:if test="@remap"> <xsl:value-of select="concat(';TYPE="',@remap,'"')" /> </xsl:if> </xsl:variable> <xsl:value-of select="concat('TEL',$spec,':',string(.))" /> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <xsl:template match="db:email" mode="vcard"> <xsl:text>EMAIL:</xsl:text> <xsl:value-of select="string(.)" /> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>MAILER:</xsl:text> </xsl:template> --> <!-- Time zone <xsl:template match="db:" mode="vcard"> <xsl:text>TZ:</xsl:text> </xsl:template> --> <!-- GPS <xsl:template match="db:" mode="vcard"> <xsl:text>GEO:</xsl:text> </xsl:template> --> <xsl:template match="db:jobtitle" mode="vcard"> <xsl:text>TITLE:</xsl:text> </xsl:template> <!-- Function <xsl:template match="db:" mode="vcard"> <xsl:text>ROLE:</xsl:text> </xsl:template> --> <xsl:template match="db:imagedata" mode="vcard"> <!-- To be implemented : easy if base64 encoded ( I guess) --> <!-- <xsl:text>LOGO:</xsl:text> --> </xsl:template> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>AGENT:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>ORG:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>CATEGORIES:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:personblurb" mode="vcard"> <xsl:text>NOTE:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>REV:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>SORT-STRING:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>SOUND:</xsl:text> </xsl:template> --> <xsl:template match="db:uri" mode="vcard"> <xsl:text>URL:</xsl:text> <xsl:value-of select="string(.)" /> <xsl:text> </xsl:text> <!-- newline character --> </xsl:template> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>URL:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>UID:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>VERSION:</xsl:text> </xsl:template> --> <!-- <xsl:template match="db:" mode="vcard"> <xsl:text>KEY:</xsl:text> </xsl:template> --> </xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]