Visning af specielle Elementer med attributter i XSL
Først lidt info:Min XML ser således ud:
<COMM_SITUATION ID="1">
<DETAILS>
<DATE format="DD-MM-YEAR">
<DATE_COMM>01-01-2006</DATE_COMM>
<DATE_RATED>01-02-2006</DATE_RATED>
</DATE>
<FILENAME>09012da680035daa_16x9_bb.avi</FILENAME>
<PUBLISHER ID="1.000">BBC HardTalk</PUBLISHER>
<TYPE ID="2.000">Interview</TYPE>
<TOPIC ID="3.000">Mohammed Cartoon Case</TOPIC>
<PARTICIPANTS>
<SPEAKER ID="0" name="Flemming Rose"/>
<SPEAKER ID="1" name="Abu Laban"/>
<SPEAKER ID="2" name="Hardtalk, Interviewer"/>
</PARTICIPANTS>
</DETAILS>
<TIMED_EVENTS>
<DATA>
<TIME format="HH.MM.SS.MS" start="00:00:00.00" stop="00:00:04.12"/>
<VIDEO>
<SPEAKER ID="0">Legs crossed</SPEAKER>
</VIDEO>
<AUDIO>
<SPEAKER ID="0">I think it would be very unfortunate</SPEAKER>
</AUDIO>
</DATA>
<DATA>
...
</DATA>
</TIMED_EVENTS>
</COMM_SITUATION>
<COMM_SITUATION ID="2">... osv.
Hvordan får jeg vist name på SPEAKER's fra en speciel COMM_SITUATIION ID?
Her er min XSL:
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://alsvik.dk/comm" exclude-result-prefixes="NonHtml a" xmlns:NonHtml="http://www.progress.com/StylusStudio/NonHtml">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html><head/>
<body>
<p align="left">
<strong>Communication ID: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/@ID"/>
</p>
<p align="left">
<strong>Comm. Filename: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:FILENAME"/>
</p>
<p align="left">
<strong>Date: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:DATE/a:DATE_COMM"/>
</p>
<p align="left">
<strong>Date of rating: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:DATE/a:DATE_RATED"/>
</p>
<p align="left">
<strong>Publisher: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:PUBLISHER"/> -
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:PUBLISHER/@ID"/>
</p>
<p align="left">
<strong>Type: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:TYPE"/> -
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:TYPE/@ID"/>
</p>
<p align="left">
<strong>Topic: </strong>
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:TOPIC"/> -
<xsl:value-of select="a:ROOT_COMM/a:COMM_SITUATION/a:DETAILS/a:TOPIC/@ID"/>
</p>
<p align="left">
<strong>Participants: </strong>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Problemet ligger i Participants (nederst i XSL), hvor jeg gerne vil have vist de SPEAKER/@name som ligger under en given COMM_SITUATION@ID
Og hvordan sikrer jeg mig at det der bliver vist er fra den rigtige COMM_SITUATION@ID?!
Håber virkelig nogen kan hjælpe mig!?