xsl-list
[Top] [All Lists]

Re: [xsl] [XSLT] Asking or Update variable

2008-03-12 08:56:00
Izaskun,

at first I thought this was a repeat of your original post, but I see you've added an xsl:choose at the bottom of your question. Did you take a look at Dr. Kay's response? It simplifies your XSLT by replacing the two xsl:for-each statements with the xsl:variable, and allows you to use the variable IsSubclass in the subsequent xsl:choose per your request. For example, here would be the updated xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
 <xsl:param name="class">PersonList</xsl:param>
 <xsl:param name="subclass">rdfs:subClassOf</xsl:param>

 <xsl:template match="rdf:RDF">

<xsl:variable name="IsSubClass" select="boolean(*[(_at_)rdf:ID=$class]/*[name()=$subclass])"/>

   <xsl:choose>
     <xsl:when test="IsSubclass">
     ...
     </xsl:when>
     <xsl:otherwise>
     ...
     </xsl:otherwise>
   </xsl:choose>

 </xsl:template>

</xsl:stylesheet>

...sam


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>