<?xml version='1.0'?><!-- -*- mode: indented-text;-*- -->
<xsl:transform
    xmlns:xsl  ="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:web  ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:h    ="http://www.w3.org/1999/xhtml"
    xmlns:kb   ="http://www.w3.org/People/Connolly/kb#"
    xmlns:pa   ="http://www.w3.org/2000/08/palm56/addr#"
    xmlns:pd   ="http://www.w3.org/2000/08/palm56/datebook#"
    >
<xsl:output method="xml" indent="yes"/>

<div xmlns="http://www.w3.org/1999/xhtml">
<p>@@this only takes the form of RDF spit out
by notation3.py; it should take all of
RDF; see rdfp.xsl</p>

<address>Dan Connolly <br class=""/>
$Id: rdfnorm.xsl,v 1.1 2000/10/17 06:45:48 connolly Exp $</address>
</div>

<xsl:template match="/web:RDF">
  <web:RDF>
  <!-- sort propElements by subject;
       pick one per subject -->
  <xsl:for-each select="*/*[not(../@about = following::*/../@about)]">
    <xsl:sort select="../@about"/>

    <xsl:variable name="subject"
		  select="../@about"/>

    <web:Description about='{../@about}'>
      <xsl:for-each select="/web:RDF/*[@about=$subject]/*">
        <xsl:element name="{name()}"
		     namespace="{namespace-uri()}">
          <xsl:choose>
	    <xsl:when test="@resource">
	      <xsl:attribute name="resource">
	        <xsl:value-of select="@resource"/>
	      </xsl:attribute>
	    </xsl:when>

	    <xsl:otherwise>
	      <xsl:value-of select="."/>
	    </xsl:otherwise>
	  </xsl:choose>
        </xsl:element>
      </xsl:for-each>
    </web:Description>
  </xsl:for-each>      
  </web:RDF>
</xsl:template>

<!-- don't pass text thru -->
<xsl:template match="text()|@*">
</xsl:template>


</xsl:transform>

