[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML transformation to RDF with XSLT help
Hi Oknam,
First, thank you for the details of your xml input, expected output, and current status of your xslt stylesheet. You should just add what gets you stuck, which would help people understand your problem quicker :) The typical way of handling three different outputs depending on different inputs is to write a different template rule (xsl:template) for each one, with three different corresponding XPath expressions. In your case, just translate your requirements to XSLT: I need to transform this to rdf like this With xsi:type="dcterms:URI" <rdf:Description> <gemq:teachingMethods rdf:resource="http://purl.org/gem/instance/GEM-TM/#PeerTutoring"/> </rdf:Description>
With xsi:type="gemq:GEM-TM" <rdf:Description> <gemq:teachingMethods> <gemq:GEM-TM> <rdf:value>Thematic approach</rdf:value> <rdfs:label>Thematic approach</rdfs:label> </gemq:GEM-TM> </gemq:teachingMethods> </rdf:Description>
And with just free-text <rdf:Description> <gemq:teachingMethods>MultimediaInstruction</dc:identifier> </rdf:Description>
This last rule will be applied when the two previous ones don't match. The job of the XSLT processor is to choose the most specific template matching your input (based on the match attribute), so you generally don't need to write this kind of "xsl:choose" explicitly. The problems I expect with the XSLT you wrote are: - you cannot create attributes before you create the parent element: your xsl:attribute instructions should appear inside the block <gemq:teachingMethods>(...)</gemq:teachingMethods> - the "test" expressions do not match your requirements (not[@xsi:type] won't match elements with "xsi:type="gemq:GEM-TM") I hope that helps, Best regards, Eric BrC)chemier On 5/3/06, oknam park <ponda7777@xxxxxxxxxxx> wrote: Hello. I'm working on a xml transformation to RDF with XSLT help.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|