<xsl:transform
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:po="http://www.w3.org/2003/g/po-ex"
    xmlns:poF="http://www.w3.org/2003/g/po-ex#"
    >

<xsl:output method="xml" indent="yes" />

<div xmlns="http://www.w3.org/1999/xhtml">
<h1>grokPO.xsl -- interpret purchase order format as RDF</h1>
<p>This is a <a href="http://www.w3.org/2003/g/data-view">GRDDL</a>
transformation that transforms purchase orders per a
<a href="po-ex.xsd">po-ex.xsd</a> schema (adapted
from <a href="http://www.w3.org/TR/xmlschema-0/#po1.xsd">po1.xsd</a>
from the XML Schema primer) into RDF.</p>
<address>
Dan Connolly, Dec 2004 <br />
<small>$Id: grokPO.xsl,v 1.1 2004/12/07 23:33:27 connolly Exp $</small>
</address>
</div>

<xsl:template match="/">
  <rdf:RDF>
    <xsl:apply-templates />
  </rdf:RDF>
</xsl:template>

<xsl:template match="po:purchaseOrder">
  <poF:purchaseOrder>
    <poF:orderDate><xsl:value-of select="@orderDate" /></poF:orderDate>
    <xsl:apply-templates />
  </poF:purchaseOrder>
</xsl:template>

<!-- complex properties -->
<xsl:template match="po:shipTo | po:billTo ">
  <xsl:element name="{name()}"
	       namespace="{concat(namespace-uri(), '#')}">
    <xsl:attribute name="parseType"
		   namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
		   >Resource</xsl:attribute>

    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

<!-- text properties -->
<xsl:template match="po:name | po:street | po:city | po:state | po:zip 
		     | po:comment">
  <xsl:element name="{local-name()}"
	       namespace="{concat(namespace-uri(), '#')}">
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

</xsl:transform>
