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

Re: Fine tuning a template match

Subject: Re: Fine tuning a template match
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Mon, 31 Jul 2006 00:00:11 -0500
Re:  Fine tuning a template match
Hi, Trevor,

I sympathize, as I am doing FrameMaker-to-DocBook for my current client.

If I understand correctly, you want to narrow the XRefs within tables. If
so, could you add [ancstor::TABLE]:

<!-- hyperlink targets in rows -->

That would ensure that this template matches only A elements that somewhere
within tables.

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, July 30, 2006 10:56 PM
Subject:  Fine tuning a template match

> Hi
> I am trying to transform some FrameMaker-generated XML that contains lots
> tables. The tables optionally include a set of titles, and these titles
> usually wrapped in a caption element - but sometimes the caption element
> also includes all the table rows :-(
> Scattered "randomly" through the tables we have <A id=> elements and my
> requirement is to process all title-related <A> elements before the table,
> and all row-related <A> elements within their row. There are <A id=>
> elements elsewhere in the document, hence some of the conditions in the
> template which is designed to process them.
> The following extract successfully identifies the table types and the <A>
> elements to be processed at the head of the tables:
> ==============
> <!-- tables -->
> <!-- some tables have one caption child and multiple row children-->
> <xsl:template match="TABLE[CAPTION and ROW]">
> <xsl:apply-templates select="CAPTION//A[@ID]" mode="tblhd"/>
> <xsl:element name="table">...</xsl:element>
> </xsl:template>
> <!-- others have all the rows inside the caption -->
> <!-- in this case the title is wrapped in a titlelist -->
> <xsl:template match="TABLE[CAPTION/ROW]">
> <xsl:apply-templates select="CAPTION/TableTitleList//A[@ID]" mode="tblhd"
> <xsl:element name="table">...</xsl:element>
> </xsl:template>
> <!-- and others have no caption at all -->
> <xsl:template match="TABLE">
> <xsl:element name="table">...</xsl:element>
> </xsl:template>
> ...
> <!-- hyperlink targets in headings -->
> <xsl:template match="A[@ID]" mode="tblhd">
> ...
> </xsl:template>
> <!-- hyperlink targets in rows -->
> <xsl:template
> ...
> </xsl:template>
> ==============
> As it stands this last template which matches all ID'ed "A" elements in
> tables causes these elements to be processed twice - once by the moded
> template and once by the standard template, so that the XML generated for
> hyperlink target appears both before the <table> element and once again
> inside it. So I need to fine tune the final template somehow: I need to
> exclude the pre-table context from the un-moded template. Does that make
> sense?
> Cheers
> Trevor

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

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.
First Name
Last Name
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-2013 All Rights Reserved.