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

Lopping off Element Type names with substring-after

Subject: Lopping off Element Type names with substring-after
From: John Robert Gardner <John.Robert.Gardner@xxxxxxxxxxxx>
Date: Mon, 14 Aug 2000 12:25:59 -0400 (EDT)
lopping
Whyizzit that the simple things seem most difficult.

Take a slew of tag names (please, _take_ them) like MyBusiness.process.shipment, 
AnotherBusiness.process.payment, etc.  I want to output the entire tree, only I 
want to use substring-after to lop off whatever follows the first "." in the 
element type names that have periods (with the exception of a couple tags).

source (something like)
	<MyBusiness>
		<MyBusiness.process.shipment>stuff</MyBusiness.process.shipment
		<MyBusiness.process.payment>
			more stuff</MyBusiness.process.payment>
		<OrKeepThis.kind.of.tag>
			complete tag retained</OrKeepThis.kind.of.tag>
	</MyBusiness>
	<YourBusiness>
		<YourBusiness.process.shipment>
			stuff</YourBusiness.process.shipment
		<YourBusiness.process.payment>
			more stuff</YourBusiness.process.payment>
		<AndKeepThis.kind.of.tag>
			complete tag retained</AndKeepThis.kind.of.tag>
	</YourBusiness>

script

<!-- to copy the whole tree -->
	
	<xsl:template match="/">
		<xsl:copy-of select="@*|*|text()" />
	</xsl:template>
	
<!-- to trim most, but not all, the tag names -->
	
	<xsl:template match="//*[not(contains(name(), 'AndKeep'))
		and not(contains(name(), 'OrKeep'))]">
		<xsl:copy-of select="*[substring-after(name(), '.')]" />
	</xsl:template>
	
 . . . I'm getting all kinds of gibberish, with the OrKeep and AndKeep at the 
top of a double-size output (double the size of the input) where all the full 
 tag names are still not even lopped off. 
 
 I figure two basic problems here, which--I regret--cover the entire endeavor:
 I'm not effectively replicating the inp[ut source (I'm iterating parts of it), 
and I'm not effectively implementing the lopping-off with substring-after().
 
 Suggestions?
 
 jr


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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