[Home] [By Thread] [By Date] [Recent Entries]
Hi Syd!
This seems to work: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="foreign">
<xsl:variable name="lang" select="ancestor::*[@lang][1]/@lang"/>
<xsl:choose>
<xsl:when test="@lang != $lang">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template> <xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template></xsl:stylesheet> (if I've correctly understood the problem) Cheers, Hugh /** * Hugh A. Cayless, Ph.D * Head, Research & Development Group * Carolina Digital Library and Archives * UNC Chapel Hill * hcayless@xxxxxxxxxxxxx */ On Jul 13, 2008, at 8:46 PM, Syd Bauman wrote: The idea here is that I want a template that will match any <foreign> element that has a lang= attribute with a value that matches the lang= attribute value of said <foreign> element's nearest ancestor that has a lang= attribute specified. (So that I can delete said <foreign>.) I.e. in
|

Cart



