Subject:XSL Pre processing Author:Rohit K Date:09 Jul 2007 12:09 PM
I have an XSL of around 3000 lines. It is used to transform an input XML. Now the requirement is that before the XSL transforms the XML, I need to make some modification in the input XML. Like I need to update values
in 2-3 tags of the input XML before I transform it. The rest of the input XML should be as it is.
For example, suppose there are 20 tags and then a tag called <Check> and follwed by 10 more tags.
What I need is before my XSL transforms this XML, I need to update the value of <Check> tag based on some condition. The XSL which I have as of now should be applied to the output.
Instead of applying XSL to above input, it should be applied to
<tags>
.
.
.
.
<Check>sorry</Check>
.
.
.
.
<tags>
The difference is that I have updated the value of the tag (Depending on a condition).
My question is where should I write this logic so that before I apply the XSL, my input XML should be modified
and the updated XML should be used.
Subject:XSL Pre processing Author:James Durning Date:12 Jul 2007 01:37 PM
I can immediately see 3 possible methods of doing this.
1. Do 2 transformations. One with a preprocessing XSLT, which simply copies everything, except for a Check template.
2. Add in the modification in place. This depends on the structure of your XSLT.
3. Create a temporary result variable with the value of the check nodes at the beginning, or a temporary result variable containing the new modified input XML. Then pass this variable in to be transformed.
Subject:XSL Pre processing Author:Rohit K Date:12 Jul 2007 02:29 PM
Hi
Thanks for the reply. I have posted another thread in this forum..Just to clarify my requirements again. The XSL which I have is very big...around 3,500 lines. Also the value of the tag which I want to update has been referred at many places in the XSL.
Subject:XSL Pre processing Author:Tony Lavinio Date:13 Jul 2007 01:19 AM
Stylus Studio lets you build pipelines of operations.
You could make the change in the first XSLT, and then
have a second one read its input and transform that.
Subject:XSL Pre processing Author:Rohit K Date:13 Jul 2007 09:41 AM
Can I have a logic in my XSL something like:
-From start of the incoming XML to the point where <Check> appears, put it as it is in out.xml.
-Process tags between <check> and </check>
-From </check> onwards till end of XML, put it as it is in out.xml.
Subject:XSL Pre processing Author:Rohit K Date:16 Jul 2007 06:09 PM
Hi
Thanks a lot. I used Identity transformation and I am able to generate second XML which is same as the first one except for value of the tag I wanted to change.
Now my problem is I need to use this XSL which I have developed from my original XSL which would be used for actual transformation. This XSL uses template match="/" so I dont think my identity XSL would be invoked.
The earlier flow was something like this:
In.xml--->Orig XSL-->Out.xml
Now it would be
In.xml-->Identity XSL-->temp.xml-->Orig XSL-->Out.xml
What I am looking for is that I should apply Orig XSL to my xml even now but from my Orig XSL, it should first invoke Identity XSL and then transform.
Hope the requirement is clear. The Orig XSL uses template match="/".
Subject:XSL Pre processing Author:Tony Lavinio Date:17 Jul 2007 04:08 PM
A test case would help. It's very hard to explain how to
merge the identity transformation with the rest of your XSLT
if you haven't shown us any of them.
Really, what is needed is an input document and both XSLTs.
Otherwise, it's just a guessing game, and time is too valuable -
for both of us.
If you want private help, you can zip the files and email them
to stylus-field-report@progress.com
Subject:XSL Pre processing Author:Rohit K Date:03 Aug 2007 02:40 PM
Hi
Sorry was out for few days. See the actual code which I am working on is huge. But I can give a very simple example of what my exact requirement is.
I have one XML (in.xml) which is say like this:
We do not want to change our existing XSL for that because the impact would be huge. What we have done is that we have created another XSL which does identity transformation and operates only on tag <first>.
So the output of this new XSL (test2.xsl) is:
Now this output should be given as the input to our original XSL (test1.xsl).
Currently we directly apply test1.xsl on in.xml. We do not want to change this. So even now, directly test1.xsl would be applied but we need to first call test2.xsl from it which does this identity transformation and then its output should be taken as the input by test1.xsl.