[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Glossary Help

Subject: RE: Glossary Help
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Sat, 29 Jul 2006 15:22:27 +0530
RE:  Glossary Help
Hi,

Migrating glossary xsl code to main xsl----which copies source xml to
outputxml with Updates of glossary elements in outputxml, but getting output
with no contents in divisions. Except glossary. What changes will required?

XSL for the same......

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	
	<xsl:template match="division">
	<xsl:if test="@type='appendix'">
		<division>
			<xsl:copy-of select="@*"/>
			<xsl:for-each select="topic">
				<topic>
					<xsl:copy-of select="@*"/>
					<xsl:copy-of select="title"/>
					<xsl:apply-templates select="body"/>
				</topic>
			</xsl:for-each>
		</division>
		</xsl:if>
	</xsl:template>
	<xsl:template match="body">
		<glossarylist>
			<!--xsl:apply-templates
select="p/i/b[not(../../text())]" /-->
			<xsl:apply-templates select="p[not(text())]/i/b"/>
			<xsl:apply-templates select="p/i/b[../../text()]"/>
			<xsl:apply-templates select="p/b[not(../text())]"/>
			<xsl:apply-templates select="p/b[../text()]"/>
		</glossarylist>
	</xsl:template>
	<xsl:template match="p/i/b[not(../../text())]">
		<glossarydiv>
			<xsl:value-of select="."/>
		</glossarydiv>
	</xsl:template>
	<xsl:template match="p/i/b[../../text()]">
		<glossaryentry>
			<glossaryterm>
				<xsl:value-of select="."/>
			</glossaryterm>
			<glossarydef>
				<xsl:value-of select="../../text()"/>
			</glossarydef>
		</glossaryentry>
	</xsl:template>
	<xsl:template match="p/b[not(../text())]">
		<glossarydiv>
			<xsl:value-of select="."/>
		</glossarydiv>
	</xsl:template>
	<xsl:template match="p/b[../text()]">
		<glossaryentry>
			<glossaryterm>
				<xsl:value-of select="."/>
			</glossaryterm>
			<glossarydef>
				<xsl:value-of select="../text()"/>
			</glossarydef>
		</glossaryentry>
	</xsl:template>
</xsl:stylesheet>

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Saturday, July 29, 2006 2:59 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Glossary Help

>     <xsl:apply-templates select="p/i/b[not(../../text())]" />

Another example - two in one morning, apparently independent - of the
predicate being moved quite unnecessarily to the last step in a path
expression. Write:

<xsl:apply-templates select="p[not(text())]/i/b" />

Michael Kay
http://www.saxonica.com/

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.