xsl-list
[Top] [All Lists]

Re: [xsl] Document processing order

2017-07-07 11:41:18
You're thinking of old-fashioned procedural programming languages that modify 
data as they go along and where you have to worry about order of execution. In 
XSLT, data is immutable, and operations happen conceptually in parallel. You 
don't ever delete anything from the source document, you only refrain from 
copying it to the result.

Michael Kay
Saxonica

On 7 Jul 2017, at 17:35, Joseph L. Casale 
jcasale(_at_)activenetwerx(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

From: Michael Kay mike(_at_)saxonica(_dot_)com [mailto:xsl-list-
service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Sent: Friday, July 7, 2017 9:52 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Document processing order

I don't really see the problem, but that probably means I haven't understood
your explanation. Perhaps you could illustrate it with an example.

Hi Michael,
This relates to the sample I posted yesterday, given the following:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
   <Fragment>
       <DirectoryRef Id="WEBSITEDIR">
           <Component Id="cmpCA929998DABB546D9DBF11366AF00C73" Guid="*">
               <File Id="fil621D71236777E77CBCD8796C747EFDFF" KeyPath="yes" 
Source="$(var.MyVar)\Global.asax" />
           </Component>
           <Component Id="cmp431AD7A30B0DC39715871007A26AE68B" Guid="*">
               <File Id="fil24F96AF9459A0FF6768697EEBAAA4133" KeyPath="yes" 
Source="$(var.MyVar)\load.aspx" />
           </Component>
       </DirectoryRef>
   </Fragment>
   <Fragment>
       <ComponentGroup Id="WebsiteComponents">
           <ComponentRef Id="cmpCA929998DABB546D9DBF11366AF00C73" />
           <ComponentRef Id="cmp431AD7A30B0DC39715871007A26AE68B" />
       </ComponentGroup>
   </Fragment>
</Wix>

I create a template that matches Component elements where the child
File element has a specific Source attribute. That's simple, but then I need
to process the ComponentRef elements and omit any whose Id matches a
Component that I now have deleted.

I thought I could simply do something like;

 <xsl:template match="wix:Component[wix:File[substring(@Source, 
string-length(@Source) - 4) = '.abcd]]
 </xsl:template>

and then generate an xpath query to select all ComponentRef elements whose
Id is orphaned which seems to work in my editor using xpath 2, but the 
transform
is applied using xpath 1.

Thanks a lot for the help,
jlc

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>