|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XSL Group Results
Hi I'm trying to produce some XSLT output, I have some search results that return an item and a number of keywords associated with it. It works fine but the results print each keyword out separately with the result instead of as a group.
For example. Result 1 - http://www.csd.abdn.ac.uk/~sttaylor...amily.owl#Woman - person Result 2 - http://www.csd.abdn.ac.uk/~sttaylor...amily.owl#Woman - female Result 3 - http://www.csd.abdn.ac.uk/~sttaylor...amily.owl#Woman - woman How can I group together all keywords with the correct item as opposed to printing them out individually? E.g. Result 1 - http://www.csd.abdn.ac.uk/~sttaylor...amily.owl#Woman - person female woman Thanks The XML Code:
- <rdf:Description rdf:about="http://www.csd.abdn.ac.uk/~sttaylor/simplefamily.owl#Woman"> <os:hasKeyword>person</os:hasKeyword> <os:hasKeyword>female</os:hasKeyword> <os:hasKeyword>woman</os:hasKeyword> <rdf:type rdf:resource="http://www.csd.abdn.ac.uk/~sttaylor/taggr.owl#Result" /> </rdf:Description> - <rdf:Description rdf:about="http://www.csd.abdn.ac.uk/~sttaylor/simplefamily.owl#Boy"> <os:hasKeyword>young</os:hasKeyword> <os:hasKeyword>boy</os:hasKeyword> <os:hasKeyword>man</os:hasKeyword> <rdf:type rdf:resource="http://www.csd.abdn.ac.uk/~sttaylor/taggr.owl#Result" /> </rdf:Description> - <rdf:Description rdf:about="http://www.csd.abdn.ac.uk/~sttaylor/simplefamily.owl#Male"> <os:hasKeyword>male</os:hasKeyword> <os:hasKeyword>animal</os:hasKeyword> <rdf:type rdf:resource="http://www.csd.abdn.ac.uk/~sttaylor/taggr.owl#Result" /> </rdf:Description> XSLT I'm using Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet 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:tgr="http://www.csd.abdn.ac.uk/~sttaylor/taggr.owl#"
xmlns:os="http://www.ontosearch.org/NS/">
<xsl:template match="/rdf:RDF">
<html>
<body>
<h2>Results</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Description</th>
<th align="left">Keywords</th>
</tr>
<xsl:for-each select="rdf:Description">
<tr>
<td><xsl:value-of select="@rdf:about" /></td>
<td><xsl:value-of select="os:hasKeyword" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>
|
|
#2
|
|||
|
|||
|
Code:
<td>
<xsl:for-each select="os:hasKeyword">
<xsl:value-of select="." />
<xsl:text> </xsl:text>
</xsl:for-each>
</td>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL Group Results |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|