Subject: Re: [xsl] How should I handle very similar templates ? Inserting a string into a match spec ? From: "Richard Kerry richard.kerry@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 21 Apr 2023 08:56:00 -0000 |
Thanks for this. I am using SaxonHE 9; I believe that gives me XSLT 3. I will investigate the options given. Regards, Richard. From: Martin Honnen martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: 20 April 2023 13:04 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] How should I handle very similar templates ? Inserting a string into a match spec ? Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe. Am 4/20/2023 um 1:48 PM schrieb Richard Kerry richard.kerry@xxxxxxxx<mailto:richard.kerry@xxxxxxxx>: Applying these two will remove all Release elements, and all mentions of Debug from remaining elements. I have another stylesheet that does the opposite, ie delete Debug elements and Release attributes. What I'd like to do is pass the keywords in as parameters; something like bbbbbb<xsl:template match="*[ @Condition = '''$(Configuration)''==''{$delete-element-name}|Win32''' ]" /> bbbbbb<xsl:template match="@Condition[ .= '''$(Configuration)''==''{$delete-attribute-name}|Win32''' ]" /> with appropriate variables or parameters declared. I tried a couple of variants of the above, to no avail. But I'm not even sure if this is possible. Is it? If it is possible but I need to approach it differently, please can someone advise. With XSLT 1.0 / XSLT 1.0 processors you are not allowed to use variable or parameter references inside match patterns, if I recollect that correctly. Which XSLT version/processor are you using? For XSLT 3 it seems like your code should using shadow attributes and static params e.g. <xsl:template _match="*[ @Condition = '''$(Configuration)''==''{$delete-element-name}|Win32''' ]" /> if you declare <xsl:param name="delete-element-name" as="xs:string" static="yes" select="'Release'"/>. Otherwise you need to use string concatenation e.g. <xsl:template match="*[ @Condition = '''$(Configuration)''==''' ||$delete-element-name || '|Win32''' ]" /> XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/2528992> (by email<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How should I handle very , Martin Honnen martin | Thread | Re: [xsl] How should I handle very , Martin Honnen martin |
Re: [xsl] How should I handle very , Martin Honnen martin | Date | Re: [xsl] How should I handle very , Martin Honnen martin |
Month |