Re: Conditional & Preceding-sibling

Subject: Re: Conditional & Preceding-sibling
From: Lee Goddard <home@xxxxxxxxxxxxxx>
Date: Fri, 18 Aug 2000 13:34:33 +0100
Sorry for the bulk of this post.

> Can you post a test
> case that shows what it isn't working with?

Many thanks for your help, Jeni. Details below.
I've cut most of the stylesheet, but think 
what's there should work.

Again, many thanks
lee

--- Output ---


V1: <mor cd plur two> ==   "<morr4>" rez
       <mor cd plur three> ==   "<morr4>" ront. 
V7: <mor r1> ==   "<morroot-part1>" 2 "<morroot-part2>" 
V7: <mor r2> ==   "<morroot-part1>" 1 "<morroot-part2>" . 

--- XML Test File ---

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="d:/DATR/XSLT/dtrHTML.xsl" ?>
<DATR>
<EQUATION node="V1" path="mor cd plur two" relationship="EQUALS">
<QUOTEDPATH><ATOM value="mor"/><ATOM value="r4"/></QUOTEDPATH><ATOM value="rez"/></EQUATION>
<EQUATION node="V1" path="mor cd plur three" relationship="EQUALS">
<QUOTEDPATH><ATOM value="mor"/><ATOM value="r4"/></QUOTEDPATH><ATOM value="ront"/></EQUATION>
<EQUATION node="V7" path="mor r1" relationship="EQUALS">
<QUOTEDPATH><ATOM value="mor"/><ATOM value="root-part1"/></QUOTEDPATH><ATOM value="2"/><QUOTEDPATH><ATOM value="mor"/><ATOM value="root-part2"/></QUOTEDPATH></EQUATION>
<EQUATION node="V7" path="mor r2" relationship="EQUALS">
<QUOTEDPATH><ATOM value="mor"/><ATOM value="root-part1"/></QUOTEDPATH><ATOM value="1"/><QUOTEDPATH><ATOM value="mor"/><ATOM value="root-part2"/></QUOTEDPATH></EQUATION>
</DATR>



--- stylesheet ---

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<!-- <xsl:output method="text"/> -->
<xsl:template match="DATR">
		<TT>
		<xsl:apply-templates/>
		</TT>
		<BR/>
		<HR size="1" color="teal"/>
		<FONT size="2" face="Lucinda, Verdana, Helvectia, Arial, Sans-serif">
		Produced from DATR XML by DATR dtrHTML.xls version 0.11<BR/>
		</FONT>
</xsl:template>

<xsl:template match="*">
	<xsl:apply-templates select="*"></xsl:apply-templates>
</xsl:template>


<!-- DATR definition/equation elements -->

<xsl:template match="EQUATION">
	<!--Concatonate GROUPS of nodedefs for DATR shorthand:
	dp NOT form a union of set (cf. geraldg 06/07/00; Kay p.551),
	Only print an element's "name" attribute if the previous
	element has different "name" attribute; otherwise indent.
	Thanks to Mike Kay and Ken Holman. -->

		PRE:<xsl:value-of select="preceding-sibling::*[@node][1]/@node"></xsl:value-of><BR/>
		This:<xsl:value-of select="@node"/><BR/>
		POS:<xsl:value-of select="following-sibling::*[@node][1]/@node"></xsl:value-of><BR/>

   	<xsl:choose>
		<xsl:when test="not(@node = preceding-sibling::*[@node][1]/@node )">
			<B>
			<xsl:value-of select="@node"/>:
			</B>
		</xsl:when>
		<xsl:otherwise>
			&#160;&#160;&#160;&#160;&#160;&#160;
		</xsl:otherwise>
	</xsl:choose>
	<FONT color="olive">
	&lt;<xsl:value-of select="@path"/>&gt;
	</FONT>
	<xsl:if test="@relationship[.='EQUALS']">==</xsl:if>
	<xsl:if test="@relationship[.!='EQUALS']">=</xsl:if>
	&#160;
	<xsl:apply-templates select="*"/>
   	<xsl:if test="not(@node = following-sibling::*[@node][1]/@node)">
		<!-- end the clause -->.
	</xsl:if>
	<BR/>
</xsl:template>


</xsl:stylesheet>



[end of post]


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread