[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Why can a template rule match on a child of multip
> Why can I have a template rule like this: > > <xsl:template match="(sidRunwayTransition|sidCommonRoute|sidEnrouteTransition)/supplemental Data"> > > But I cannot have a template rule like this: > > <xsl:template > match="sid/(sidRunwayTransition|sidCommonRoute|sidEnrouteTransition)"> What is the context in which you find you canbt? Herebs a document: <root> <branch> <A/> <A/> <B/> <B/> <C/> <C/> </branch> <alternate> <A/> <A/> <B/> <B/> <C/> <C/> </alternate> </root> Herebs a stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="3.0"> <xsl:output method="xml" encoding="utf-8" indent="no"/> <xsl:mode on-no-match="shallow-copy"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="(branch|alternate)/A"> <xsl:copy> <m1/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="branch/(B|C)"> <xsl:copy> <m2/> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> And herebs what I get if I apply one to the other: <?xml version="1.0" encoding="utf-8"?><root> <branch> <A><m1/></A> <A><m1/></A> <B><m2/></B> <B><m2/></B> <C><m2/></C> <C><m2/></C> </branch> <alternate> <A><m1/></A> <A><m1/></A> <B/> <B/> <C/> <C/> </alternate> </root> Be seeing you, norm -- Norman Tovey-Walsh <ndw@xxxxxxxxxx> https://nwalsh.com/ > There comes a time when a man must take himself, for better or worse, > as his portion.--Ralph Waldo Emerson [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|