Subject: Re: [xsl] Why can a template rule match on a child of multiple elements but cannot match on multiple children of an element? From: "Norm Tovey-Walsh ndw@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 19 May 2022 13:29:23 -0000 |
> 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]
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Why can a template rule match, Roger L Costello cos | Thread | Re: [xsl] Why can a template rule m, Chris Papademetrious |
[xsl] Why can a template rule match, Roger L Costello cos | Date | Re: [xsl] Why can a template rule m, Chris Papademetrious |
Month |