| Author |
An XSLT that's just a little more Specific
|
Jose Campana
Ranch Hand
Joined: May 28, 2007
Posts: 339
|
|
Hello There !
I'm digging deeply into the world of XSL Transformations. I have done some cool things. But I feel sometimes I just need a little push to get me going.
I'm a little sorry to be so Direct, But, I'd like to know How would you do the following Transformation?
Given this XML:
How can I turn it into this:
00000000220000003
The Key to note here is that given the value which is 220000003, I need to apply the length and alignment attributes. and that's it. Easier said than done, right?
I'm honest when I say I have no clue.
Could you please help me. Like I said, I need a little something that shows me the way.
Thanks in advance.
Your Friend,
Jose
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
A recursive template.
If the length of the value is equal to the specified length, just return the value.
If the length of the value is less than the specified length, then return the result of applying the template to the value with one instance of the fill character appended at the appropriate end of the value.
If the length is greater... let me leave that for now.
|
 |
Jose Campana
Ranch Hand
Joined: May 28, 2007
Posts: 339
|
|
Hello Mr Paul.
Like I said, easier said than done.
Could you please at least show me the basic structure of how a recursive template looks like?
Please Please Please.....
Sincerely,
Jose
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
All very ordinary XSLT (written in 1 minute or less so not necessarily correct syntax or logic):
|
 |
Jose Campana
Ranch Hand
Joined: May 28, 2007
Posts: 339
|
|
Hello, Mr. Paul,
Thank you for the advice and proper sample you've showed me. I wanted to reply earlier, but the forum kept failing for repeated occasions when I submitted my responses.
So, I'll take it from there, and see what I can do.
Thank you very much,
Sincerely,
Jose.
|
 |
 |
|
|
subject: An XSLT that's just a little more Specific
|
|
|