Subject: Re: [xsl] How do I pass the mode as a string? From: "Kerry, Richard richard.kerry@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 3 Mar 2020 16:16:38 -0000 |
David: >Maybe do it in Python Me: >C++, which is what I use most of the time (XSL is infrequent Just so's you know, my mention of C++ and XSL actually means that's all I use - I think. (C# is on the horizon, and I once wrote something in Java, though that was because I couldn't find a MIB reading library for C++, else I'd have done that) I don't use Python at all, so that really isn't an option. So - if it's XML it'll be XSL to process it. Richard Kerry BNCS Engineer, SI SOL Telco & Media Vertical Practice M: +44 (0)7812 325518 2nd Floor, MidCity Place, 71 High Holborn, London, WC1V 6EA richard.kerry@xxxxxxxx<https://webmail.siemens-it-solutions.com/owa/redir.asp x?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. ________________________________ From: David Farmer farmer@xxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: 03 March 2020 15:46 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: Re: [xsl] How do I pass the mode as a string? Caution! Atos External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe. Maybe do it in Python with the "lxml" module? On Tue, 3 Mar 2020, Kerry, Richard richard.kerry@xxxxxxxx wrote: > Ok, > Thanks all for the explanations. I'll look at the alternatives. > If this was C++, which is what I use most of the time (XSL is infrequent, just when I want to manipulate some XML) I would > use some kind of polymorphism to achieve this. I'd define a couple of one-line functions with the different variables, or > calls, and pass the appropriate one to the outer function so they could be run on its results (somewhat garbled, > abbreviated explanation, sorry). I'm not aware of anything in XSL that looks like polymorphism, but I would be interested > to know if there was a construct that might be similar, or usable for cases like this one. > Granted I can't construct variable names dynamically, but I can have a number of variables existing simultaneously and > select one and pass it around by address if I need to. I don't see an analogous construct in XSL, except to use > choose/when to select a line of code based on an actual variable. > > I could send my examples if that would be best, but I think that would provide a lot of unnecessary code just to show a > small bit of context. > What I am actually trying to do is to get a number of XML files processed. The files are in similar folders, called > 'input' and 'output'. The files' names follow a couple of name patterns, acq_(\d{4}) and out_(\d{4}). There is identical > code to scan through the folders and identify the files I want to process (and extract the numbers from the filenames). > They are then passed to apply-templates with the different modes as mentioned. > So the file scanning, while not especially complicated, is not entirely trivial and I'd like to have it written just once. > And then, because the contents of the files differs in structure, they are handled by different templates, with different > modes. > > > > > Blue line > > Richard Kerry > > BNCS Engineer, SI SOL Telco & Media Vertical Practice > > M: +44 (0)7812 325518 > > 2nd Floor, MidCity Place, 71 High Holborn, London, WC1V 6EA > > richard.kerry@xxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How do I pass the mode as, David Farmer farmer@ | Thread | Re: [xsl] How do I pass the mode as, BR Chrisman brchrism |
Re: [xsl] How do I pass the mode as, Dimitre Novatchev dn | Date | Re: [xsl] How do I pass the mode as, Kerry, Richard richa |
Month |