Ok, what I`m trying to do is name an actor and a character id (cid) in one file (611.xml) and use the XSLT to compare it to another file (authors.xml) where the actor's name will be found and the cid compared to a cid contained within the 'actor' tag. The name of the character and url of a page for that character will then be output.
I've managed to get the majority of this to work except for when it finds matching results, it repeats them twice. Therefore if it finds the following in the authors.xml file which match the details in 611.xml:
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
then it will output the following:
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
I believe that as the 'cid' tags all equal 1 (as in character No. 1 for that actor) then it is matching each 'cid' with each character.
So when it finds Colin Cunningham in the authors.xml file, it matches the 'cid' not only with the 'cid' contained within that 'actor' tag, but also with the 'cid' tags contained within the 'actor' tags belonging to John DeLancie and Claudia Black.
Does anyone know of a way to match the actor name *only* with a 'cid' tag contained within that 'actor' tag.
Just incase this doesn't make any sense, below are the files I am using.
**611.xml**
<?xml version="1.0"?>
<EPISODE TITLE="Prometheus" EPNO="611" RATING="n/a"
xmlns:ref=" ref:noNamespaceSchemaLocation="xsd_PostingML.xsd"
xmlns
ml=" pml:noNamespaceSchemaLocation="xsd_PostingML.xsd">
<GCAST>
<GUEST>
<PERFORMER NAME="Colin Cunningham" CID="1"/>
</GUEST>
<GUEST>
<PERFORMER NAME="John DeLancie" CID="1"/>
</GUEST>
<GUEST>
<PERFORMER NAME="Bill Marchant" CID="1"/>
</GUEST>
</GCAST>
</EPISODE>
**pstyle_episodes.xsl (code that does the matching)**
<xsl:for-each select="GCAST/GUEST">
<xsl:if test="count(PERFORMER) = 1">
<xsl:choose>
<xsl:when test="count(PERFORMER/@CID) = 1">
<xsl:if test="$biogs/actor/@name = PERFORMER/@NAME and $biogs/actor/character/@cid = PERFORMER/@CID">
<xsl:for-each select="$biogs/actor">
<xsl:value-of select="@name"/> -
<a href="{character/url}">
<xsl:value-of select="character/name"/>
</a><br/>
</xsl:for-each>
</xsl:if>
</xsl:when>
<xsl
therwise>
<xsl:value-of select="PERFORMER/@NAME"/> -
<xsl:value-of select="CHARACTER/ROLE/@NAME"/><br/>
</xsl
therwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
**authors.xml**
<root>
<actor name="Colin Cunningham">
<character cid="1">
<name>Maj. Paul Davis</name>
<url>personnel.asp?race=tauri&pers=pauldavis</url>
</character>
</actor>
<actor name="John DeLancie">
<character cid="1">
<name>Col. Simmons</name>
<url>personnel.asp?race=tauri&pers=simmons</url>
</character>
</actor>
<actor name="Claudia Black">
<character cid="1">
<name>Aeryn Sun</name>
<url>personnel.asp?race=sebacean&pers=aerynsun</url>
</character>
</actor>
</root>
I've managed to get the majority of this to work except for when it finds matching results, it repeats them twice. Therefore if it finds the following in the authors.xml file which match the details in 611.xml:
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
then it will output the following:
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
Colin Cunningham - Maj. Paul Davis
John DeLancie - Col. Simmons
Claudia Black - Aeryn Sun
I believe that as the 'cid' tags all equal 1 (as in character No. 1 for that actor) then it is matching each 'cid' with each character.
So when it finds Colin Cunningham in the authors.xml file, it matches the 'cid' not only with the 'cid' contained within that 'actor' tag, but also with the 'cid' tags contained within the 'actor' tags belonging to John DeLancie and Claudia Black.
Does anyone know of a way to match the actor name *only* with a 'cid' tag contained within that 'actor' tag.
Just incase this doesn't make any sense, below are the files I am using.
**611.xml**
<?xml version="1.0"?>
<EPISODE TITLE="Prometheus" EPNO="611" RATING="n/a"
xmlns:ref=" ref:noNamespaceSchemaLocation="xsd_PostingML.xsd"
xmlns
<GCAST>
<GUEST>
<PERFORMER NAME="Colin Cunningham" CID="1"/>
</GUEST>
<GUEST>
<PERFORMER NAME="John DeLancie" CID="1"/>
</GUEST>
<GUEST>
<PERFORMER NAME="Bill Marchant" CID="1"/>
</GUEST>
</GCAST>
</EPISODE>
**pstyle_episodes.xsl (code that does the matching)**
<xsl:for-each select="GCAST/GUEST">
<xsl:if test="count(PERFORMER) = 1">
<xsl:choose>
<xsl:when test="count(PERFORMER/@CID) = 1">
<xsl:if test="$biogs/actor/@name = PERFORMER/@NAME and $biogs/actor/character/@cid = PERFORMER/@CID">
<xsl:for-each select="$biogs/actor">
<xsl:value-of select="@name"/> -
<a href="{character/url}">
<xsl:value-of select="character/name"/>
</a><br/>
</xsl:for-each>
</xsl:if>
</xsl:when>
<xsl
<xsl:value-of select="PERFORMER/@NAME"/> -
<xsl:value-of select="CHARACTER/ROLE/@NAME"/><br/>
</xsl
</xsl:choose>
</xsl:if>
</xsl:for-each>
**authors.xml**
<root>
<actor name="Colin Cunningham">
<character cid="1">
<name>Maj. Paul Davis</name>
<url>personnel.asp?race=tauri&pers=pauldavis</url>
</character>
</actor>
<actor name="John DeLancie">
<character cid="1">
<name>Col. Simmons</name>
<url>personnel.asp?race=tauri&pers=simmons</url>
</character>
</actor>
<actor name="Claudia Black">
<character cid="1">
<name>Aeryn Sun</name>
<url>personnel.asp?race=sebacean&pers=aerynsun</url>
</character>
</actor>
</root>