w3.org/1999/XSL/Transform"> dat..." />

How to apply an XSLT template to a node copy using variable conditions (extracted from a previous XML node)?

This simple transformation (no explicit conditionals at all): xsl:stylesheet version="1.0" xmlns:xsl="" rel="nofollow">w3.org/1999/XSL/Transform"> data void DrawHorizontal ( t_paper p , int x , int y ) {..... p x y . Hor = 1 ; ... } void DrawHorizontal ( t_paper p , int x , int y ) {..... p data x y . Hor = 1 ; ... }.

This simple transformation (no explicit conditionals at all): data when applied on the provided XML document: void DrawHorizontal ( t_paper p , int x , int y ) {..... p x y . Hor = 1 ; ... } produces the wanted result: void DrawHorizontal ( t_paper p , int x , int y ) {..... p data x y . Hor = 1 ; ... } Explanation: Overriding the identity rule just for parameters that are of the requested type.

Using a key to conveniently define the mapping between a parameter declaration and its (name, type).

I'm sure it works, but you posted the output XML without the . Data in it ;) – memetech Sep 17 at 23:24 @memetech: Thank you for notifying me -- I hadn't even noticed the data. Now added.

– Dimitre Novatchev Sep 17 at 23:31 Thanks a lot Dimitre, great answer. It works perfectly, I did not know the existence of keys. I am really thankful.D.

– Ddd Sep 18 at 7:53 everything is working fine but now I am getting a compile error when trying to use an input parameter (using xsltproc --stringparam type "t_paper" ...) in the key() function like this: key('nameofthekey', $type). The error is: xsltCompilePattern : failed to compile 'key('nameofthekey', $type)' Any idea? – Ddd Sep 18 at 13:05 ok, this is solved.It was of course due to the fact that xslt 1.0 does not allow variables within the match expression – Ddd Sep 18 at 14:30.

This is an xsl:key element/key() function answer I had to step back from your two step solution to find a workable answer. I don't know where you're getting your expression statement from, but I suppose it is something from C#/.NET. In any case I see that what you are doing is wrapping a type so that the expressions change from: pxy to p.

Dataxy If that's the case, instead of applying different appearances to the overall function, I chose to just have templates match on components of the expression. Then conditionally on each parameter name, I lookup the type to see if it is the one you are looking for. Additional 'when' statements can be added for each type you want to catch: .Data.

Memetech: This code isn't compliant XSLT (neither 1.0 or 2.0). Please, run your solution (and if necessary correct) before posting it. I also made an obvious correction, then run it only to find that the produced output was not the wanted one.

– Dimitre Novatchev Sep 17 at 23:34 I developed and ran the solution using WMHelp's XMLPad 3.0 before posting it. I verified again that it has no problem with MSXML30, MSXML40 or it's own internal transform engine. There are no validation errors.

If there is a problem with it against the XSLT specs it obviously doesn't make much of a difference. – memetech Sep 18 at 1:19 3 Ok calm down, I just told you what tool I used. Can't you assume that the tool is allowing those extensions rather than that the user of the tool is inherently a base and evil person, out to defraud the system and attack you personally?

– memetech Sep 18 at 1:26 If anyone actually tries to use this code, I will more than happily support them. The two instances of non-compliance with the spec are easily fixed using not() instead of! , and using = instead of eq.

If that's a big deal to you, use the solution proposed by @DimitreNovatchev – memetech Sep 18 at 1:40 4 @memetech, just accept that Dimitre only considers that his opinion is ever correct. He's already told me that I shouldn't be in the industry because of my opinion on an issue. – Richard A Sep 18 at 11:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions