ラベル vCard の投稿を表示しています。 すべての投稿を表示
ラベル vCard の投稿を表示しています。 すべての投稿を表示

2011年4月24日日曜日

[XML VQG] 2. XSLT (4)

Most important thing is always data.

I consuleted VIP ADDRESS to create following RDF vCard example.


<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:v="http://www.w3.org/2006/vcard/ns#">

<v:VCard rdf:about = "http://example.com/me/corky" >
<v:n>Corky Crystal</v:n>
<v:fn>Corky Crystal</v:fn>
<v:sound>
<rdf:Description>
<rdf:value>Corky</rdf:value>
<rdf:type rdf:resource="@@@X-irmc-n@@@"/>
</rdf:Description>
</v:sound>
<v:sort-string>Corky</v:sort-string>
<v:x-phonetic-first-name>Corky</v:x-phonetic-first-name>
<v:x-phonetic-last-name>Crystal</v:x-phonetic-last-name>
<v:tel>
<rdf:Description>
<rdf:value>+61 7 5555 5555</rdf:value>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Voice"/>
</rdf:Description>
</v:tel>
<v:email rdf:resource="mailto:corky@example.com"/>
<v:adr>
<rdf:Description>
<v:street-address>111 Lake Drive</v:street-address>
<v:locality>WonderCity</v:locality>
<v:postal-code>5555</v:postal-code>
<v:country-name>Australia</v:country-name>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
</rdf:Description>
</v:adr>
</v:VCard>
<v:VCard rdf:about = "http://example.com/me/al" >
<v:n>Al Pacino</v:n>
<v:fn>Al Pacino</v:fn>
<v:sound>
<rdf:Description>
<rdf:value>Al</rdf:value>
<rdf:type rdf:resource="@@@X-irmc-n@@@"/>
</rdf:Description>
</v:sound>
<v:sort-string>Al</v:sort-string>
<v:x-phonetic-first-name>Al</v:x-phonetic-first-name>
<v:x-phonetic-last-name>Pacino</v:x-phonetic-last-name>
<v:tel>
<rdf:Description>
<rdf:value>+61 7 6666 6666</rdf:value>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Voice"/>
</rdf:Description>
</v:tel>
<v:email rdf:resource="mailto:al@example.com"/>
<v:adr>
<rdf:Description>
<v:street-address>301 West 57th Street, 16C</v:street-address>
<v:locality>New York</v:locality>
<v:region>New York</v:region>
<v:postal-code>10017</v:postal-code>
<v:country-name>USA</v:country-name>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
</rdf:Description>
</v:adr>
</v:VCard>
<v:VCard rdf:about = "http://example.com/me/ethan" >
<v:n>Ethan Hawke</v:n>
<v:fn>Ethan Hawke</v:fn>
<v:sound>
<rdf:Description>
<rdf:value>Ethan</rdf:value>
<rdf:type rdf:resource="@@@X-irmc-n@@@"/>
</rdf:Description>
</v:sound>
<v:sort-string>Al</v:sort-string>
<v:x-phonetic-first-name>Ethan</v:x-phonetic-first-name>
<v:x-phonetic-last-name>Hawke</v:x-phonetic-last-name>
<v:tel>
<rdf:Description>
<rdf:value>+61 7 7777 7777</rdf:value>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Voice"/>
</rdf:Description>
</v:tel>
<v:email rdf:resource="mailto:ethan@example.com"/>
<v:adr>
<rdf:Description>
<v:street-address>c/o 1775 Broadway 701</v:street-address>
<v:locality>New York</v:locality>
<v:region>New York</v:region>
<v:postal-code>10019</v:postal-code>
<v:country-name>USA</v:country-name>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
</rdf:Description>
</v:adr>
</v:VCard>
<v:VCard rdf:about = "http://example.com/me/brad" >
<v:n>Brad Pitt</v:n>
<v:fn>Brad Pitt</v:fn>
<v:sound>
<rdf:Description>
<rdf:value>Brad</rdf:value>
<rdf:type rdf:resource="@@@X-irmc-n@@@"/>
</rdf:Description>
</v:sound>
<v:sort-string>Al</v:sort-string>
<v:x-phonetic-first-name>Brad</v:x-phonetic-first-name>
<v:x-phonetic-last-name>Pitt</v:x-phonetic-last-name>
<v:tel>
<rdf:Description>
<rdf:value>+61 7 8888 8888</rdf:value>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Voice"/>
</rdf:Description>
</v:tel>
<v:email rdf:resource="mailto:brad@example.com"/>
<v:adr>
<rdf:Description>
<v:street-address>9150 Wilshire Boulevard Suite 350</v:street-address>
<v:locality>Beverly Hills</v:locality>
<v:region>California</v:region>
<v:postal-code>90212</v:postal-code>
<v:country-name>USA</v:country-name>
<rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
</rdf:Description>
</v:adr>
</v:VCard>
</rdf:RDF>

2011年4月23日土曜日

[XML VQG] 2. XSLT (3)

I've finished creating my example related to vCard and RDF.


  • Original vCard

    BEGIN:VCARD
    VERSION:3.0
    N:Corky Crystal
    FN:Corky Crystal
    SOUND;X-IRMC-N:Corky;
    SORT-STRING:Corky
    X-PHONETIC-FIRST-NAME:Corky
    X-PHONETIC-LAST-NAME:Crystal
    TEL;HOME;VOIDE:+61 7 5555 5555
    EMAIL:corky@example.com
    ADR;HOME:;;111 Lake Drive;WonderCity;;5555;Australia
    END:VCARD


  • RDF vCard

    <?xml version="1.0"?>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:v="http://www.w3.org/2006/vcard/ns#">

    <v:VCard rdf:about = "http://example.com/me/corky" >
    <v:n>Corky Crystal</v:n>
    <v:fn>Corky Crystal</v:fn>
    <v:sound>
    <rdf:Description>
    <rdf:value>Corky</rdf:value>
    <rdf:type rdf:resource="@@@X-irmc-n@@@"/>
    </rdf:Description>
    </v:sound>
    <v:sort-string>Corky</v:sort-string>
    <v:x-phonetic-first-name>Corky</v:x-phonetic-first-name>
    <v:x-phonetic-last-name>Crystal</v:x-phonetic-last-name>
    <v:tel>
    <rdf:Description>
    <rdf:value>+61 7 5555 5555</rdf:value>
    <rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
    <rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Voice"/>
    </rdf:Description>
    </v:tel>
    <v:email rdf:resource="mailto:corky@example.com"/>
    <v:adr>
    <rdf:Description>
    <v:street-address>111 Lake Drive</v:street-address>
    <v:locality>WonderCity</v:locality>
    <v:postal-code>5555</v:postal-code>
    <v:country-name>Australia</v:country-name>
    <rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Home"/>
    </rdf:Description>
    </v:adr>
    </v:VCard>
    </rdf:RDF>


2011年4月12日火曜日

[XML VQG] 2. XSLT (2)

I was a bit disappointed at realizing that Google Chrome can't handle xml files with xsl. Safari can handle them.
And emacs seems to lack XML related tools, because there are no good elisps to deal with even XSLT.


  • Here, how to use Saxon on cui to run the examples in the book.


    bash-3.2$ java -cp ~/Dropbox/java/lib/saxon9he.jar net.sf.saxon.Transform -t -s:02-01.xml -xsl:02-03.xsl
    Saxon-HE 9.3.0.4J from Saxonica
    Java version 1.6.0_24
    Warning: at xsl:stylesheet on line 2 column 80 of 02-03.xsl:
    Running an XSLT 1 stylesheet with an XSLT 2 processor
    Stylesheet compilation time: 3222 milliseconds
    Processing file:/Volumes/Macintosh%20HD2/Dropbox/programming/xml-visual-quickstart-guide/Chapter_02_examples/02-01.xml
    Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
    Building tree for file:/Volumes/Macintosh%20HD2/Dropbox/programming/xml-visual-quickstart-guide/Chapter_02_examples/02-01.xml using class net.sf.saxon.tree.tiny.TinyBuilder
    Tree built in 1 milliseconds
    Tree size: 16 nodes, 32 characters, 1 attributes
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Wonders of the World</title>
    </head>
    <body>
    <h1>Wonders of the World</h1>



    The Colossus of Rhodes
    is located in Rhodes, Greece.


    </body>
    </html>Execution time: 320ms
    Memory used: 21579320
    NamePool contents: 19 entries in 19 chains. 6 prefixes, 6 URIs
    bash-3.2$


  • Hum, XSLT files are in the end XML files, and it must be well-formed. That kind of restriction must be not adequate as a template language.

  • As the content of sample xml files, ancient wonders are boring. So I'd better create my examples.

  • I've thought about which kind of data I should deal with as my own examples, and I realized that the address data would be fine with me. I'll adopt vCard objects in RDF as the xml vocabulary. [Representing vCard Objects in RDF]
    And you can also check what the vCard data in the wild are in my wiki entry. [aka:アドレス帳]