levalencia Posted August 27, 2007 Share Posted August 27, 2007 Hello All, I need to find a way to convert a OWL file to HTML, I found one on Internet but I have that error.This is the xslt file. <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="uri.local-functions" xmlns:rdf=" [url="http://www.w3.org/1999/02/22-rdf-syntax-ns#""]http://www.w3.org/1999/02/22-rdf-syntax-ns#"[/url] xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#"> <xsl:output indent="yes"/> <xsl:template match="/"> <!-- build heirarchy for daughter's parent --> <xsl:apply-templates mode="hierarchy" select="local:ancestors-of(/rdf:RDF/owl:Class[@rdf:ID='Daughter'])[2]"/> </xsl:template> <!-- build hierarchy of all owl:Class descendents --> <xsl:template mode="hierarchy" match="owl:Class"> <xsl:variable name="name" select="local:name-of(.)"/> <xsl:element name="{$name}"> <xsl:apply-templates mode="#current" select="//owl:Class[ rdfs:subClassOf[ @rdf:resource=current()/@rdf:about or owl:Class/@rdf:about=current()/@rdf:about]]"/> </xsl:element> </xsl:template> <xsl:function name="local:name-of" as="xs:string"> <xsl:param name="class" as="element(owl:Class)"/> <xsl:choose> <xsl:when test="$class/@rdf:ID"> <xsl:value-of select="$class/@rdf:ID"/> </xsl:when> <xsl:when test="$class/@rdf:about"> <xsl:value-of select="substring($class/@rdf:about, 2)"/> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Unable to extrapolate an element name from </xsl:text> <xsl:sequence select="$class"/> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:function> <!-- find the ancestors to an owl:Class (assumes only one ancestor is possible) --> <xsl:function name="local:ancestors-of" as="element(owl:Class)+"> <xsl:param name="class" as="element(owl:Class)"/> <xsl:variable name="parent-id" select="$class/rdfs:subClassOf/@rdf:resource, $class/rdfs:subClassOf/owl:Class/@rdf:about"/> <xsl:variable name="ancestor" select="$class/../owl:Class[$parent-id = @rdf:about]"/> <xsl:choose> <xsl:when test="$ancestor"> <xsl:sequence select="$class, local:ancestors-of($ancestor)"/> </xsl:when> <xsl:otherwise> <xsl:sequence select="$class"/> </xsl:otherwise> </xsl:choose> </xsl:function></xsl:stylesheet> and this is the ontology file <?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns="http://www.xfront.com/owl/ontologies/camera/#" xmlns:camera="http://www.xfront.com/owl/ontologies/camera/#" xml:base="http://www.xfront.com/owl/ontologies/camera/"> <![CDATA[ <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> <!-- --> <!-- Camera OWL Ontology --> <!-- --> <!-- Author: Roger L. Costello --> <!-- Acknowlegements: Many thanks to the following people for --> <!-- their invaluable input: --> <!-- Richard McCullough, Yuzhong Qu, --> <!-- Leo Sauermann, Brian McBride and --> <!-- Jim Farrugia. --> <!-- --> <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> ]]> <owl:Class rdf:ID="Money"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <owl:DatatypeProperty rdf:ID="currency"> <rdfs:domain rdf:resource="#Money"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> <owl:Class rdf:ID="Range"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <owl:DatatypeProperty rdf:ID="min"> <rdfs:domain rdf:resource="#Range"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#float"/> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="max"> <rdfs:domain rdf:resource="#Range"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#float"/> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="units"> <rdfs:domain rdf:resource="#Range"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> <owl:Class rdf:ID="Window"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <camera:Window rdf:ID="ThroughTheLens"/> <camera:Window rdf:ID="WindowOnTopOfCamera"/> <owl:Class rdf:ID="Viewer"> <owl:oneOf rdf:parseType="Collection"> <camera:Window rdf:about="#ThroughTheLens"/> <camera:Window rdf:about="#WindowOnTopOfCamera"/> </owl:oneOf> </owl:Class> <owl:Class rdf:ID="PurchaseableItem"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <owl:ObjectProperty rdf:ID="cost"> <rdfs:domain rdf:resource="#PurchaseableItem"/> <rdfs:range rdf:resource="#Money"/> </owl:ObjectProperty> <owl:Class rdf:ID="Body"> <rdfs:subClassOf rdf:resource="#PurchaseableItem"/> </owl:Class> <owl:Class rdf:ID="BodyWithNonAdjustableShutterSpeed"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Body"/> <owl:Restriction> <owl:onProperty rdf:resource="#shutter-speed"/> <owl:cardinality>0</owl:cardinality> </owl:Restriction> </owl:intersectionOf> </owl:Class> <owl:Class rdf:ID="Lens"> <rdfs:subClassOf rdf:resource="#PurchaseableItem"/> </owl:Class> <owl:Class rdf:ID="Camera"> <rdfs:subClassOf rdf:resource="#PurchaseableItem"/> </owl:Class> <owl:Class rdf:ID="SLR"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Camera"/> <owl:Restriction> <owl:onProperty rdf:resource="#viewFinder"/> <owl:hasValue rdf:resource="#ThroughTheLens"/> </owl:Restriction> </owl:intersectionOf> </owl:Class> <owl:Class rdf:ID="Large-Format"> <owl:subClassOf rdf:resource="#Camera"/> <owl:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#body"/> <owl:allValuesFrom rdf:resource="#BodyWithNonAdjustableShutterSpeed"/> </owl:Restriction> </owl:subClassOf> </owl:Class> <owl:Class rdf:ID="Digital"> <rdfs:subClassOf rdf:resource="#Camera"/> </owl:Class> <owl:ObjectProperty rdf:ID="part"/> <owl:ObjectProperty rdf:ID="lens"> <rdfs:subPropertyOf rdf:resource="#part"/> <rdfs:domain rdf:resource="#Camera"/> <rdfs:range rdf:resource="#Lens"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="body"> <rdfs:subPropertyOf rdf:resource="#part"/> <rdfs:domain rdf:resource="#Camera"/> <rdfs:range rdf:resource="#Body"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="viewFinder"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/> <rdfs:domain rdf:resource="#Camera"/> <rdfs:range rdf:resource="#Viewer"/> </owl:ObjectProperty> <owl:DatatypeProperty rdf:ID="size"> <rdfs:domain rdf:resource="#Lens"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="aperture"> <rdfs:domain rdf:resource="#Lens"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> <owl:ObjectProperty rdf:ID="compatibleWith"> <rdfs:domain rdf:resource="#Lens"/> <rdfs:range rdf:resource="#Body"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="shutter-speed"> <rdfs:domain rdf:resource="#Body"/> <rdfs:range rdf:resource="#Range"/> </owl:ObjectProperty> <owl:DatatypeProperty rdf:ID="focal-length"> <owl:equivalentProperty rdf:resource="#size"/> <rdfs:domain rdf:resource="#Lens"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="f-stop"> <owl:equivalentProperty rdf:resource="#aperture"/> <rdfs:domain rdf:resource="#Lens"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> </owl:DatatypeProperty> </rdf:RDF> Link to comment Share on other sites More sharing options...
levalencia Posted August 27, 2007 Author Share Posted August 27, 2007 I forgot to say that I use ASP.nET, the XML controlits very easy <body> <form id="form1" runat="server"> <div> <asp:Xml ID="Xml1" runat="server" DocumentSource="~/camera.xml" TransformSource="~/XSLTFile.xsl"></asp:Xml></div> </form></body> Link to comment Share on other sites More sharing options...
boen_robot Posted August 27, 2007 Share Posted August 27, 2007 ASP.NET doesn't, at least by default, support XSLT 2.0. You'll have to find a way to install SAXON on .NET or try to use another stylesheet that's XSLT 1.0. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.