We use XSLT in data transformation and in one particular situation we might want to use same value for different fields. A variable in such case is a best approach one could think of. Below is the code snippet which is used in xslt in order to create and use a variable.
Below is a part of xslt which can be referred as an example,
<sch:ReceivedReturnCenter>
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</sch:ReceivedReturnCenter>
<sch:SendBackToCustomer>
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</sch:SendBackToCustomer>
Here both the target values "ReceivedReturnCenter" and "SendBackToCustomer" are mapped to a single value which is concatenation/substring of another field "GRDATE".
No doubt with this approach we would achieve the solution but its unnecessary to perform the same logic multiple times. Hence ideally we would be having the logic stored in a variable and use that variable to assign to both the target fields. Here is how we can do it,
<xsl:variable name="grDate">
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</xsl:variable>
<sch:ReceivedReturnCenter>
<xsl:value-of select="$grDate" />
</sch:ReceivedReturnCenter>
<sch:SendBackToCustomer>
<xsl:value-of select="$grDate" />
</sch:SendBackToCustomer>
Usage of variable : $grDate
Note : There is a drawback of using variable in xslt as the same variable cannot be edited later (or I am not aware of :P). Variables in xslt are supposed to be initialized/assigned a value only once.
Below is a part of xslt which can be referred as an example,
<sch:ReceivedReturnCenter>
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</sch:ReceivedReturnCenter>
<sch:SendBackToCustomer>
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</sch:SendBackToCustomer>
Here both the target values "ReceivedReturnCenter" and "SendBackToCustomer" are mapped to a single value which is concatenation/substring of another field "GRDATE".
No doubt with this approach we would achieve the solution but its unnecessary to perform the same logic multiple times. Hence ideally we would be having the logic stored in a variable and use that variable to assign to both the target fields. Here is how we can do it,
<xsl:variable name="grDate">
<xsl:value-of xmlns:sch="http://schemas.cordys.com/" select="concat(substring(/sch:ROConDTInput/sch:request/sch:GRDATE,7,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,5,2),substring(/sch:ROConDTInput/sch:request/sch:GRDATE,1,4))" />
</xsl:variable>
<sch:ReceivedReturnCenter>
<xsl:value-of select="$grDate" />
</sch:ReceivedReturnCenter>
<sch:SendBackToCustomer>
<xsl:value-of select="$grDate" />
</sch:SendBackToCustomer>
Usage of variable : $grDate
Note : There is a drawback of using variable in xslt as the same variable cannot be edited later (or I am not aware of :P). Variables in xslt are supposed to be initialized/assigned a value only once.
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
ReplyDeletedata science
Machine Learning Projects for Final Year machine learning projects for final year
DeleteDeep Learning Projects assist final year students with improving your applied Deep Learning skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can include Deep Learning projects for final year into your portfolio, making it simpler to get a vocation, discover cool profession openings, and Deep Learning Projects for Final Year even arrange a more significant compensation.
Python Training in Chennai Python Training in Chennai Angular Training Project Centers in Chennai
Nice Post...I have learn some new information.thanks for sharing.
ReplyDeleteExcelR data analytics course in Pune | business analytics course | data scientist course in Pune
Such a very useful article. I have learn some new information.thanks for sharing.
ReplyDeletedata scientist course in mumbai
I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
ReplyDeleteData Analytics Course in Mumbai
Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
ReplyDeleteData Analytics Course in Mumbai
Such a very useful article. Very interesting to read this article. I have learn some new information.thanks for sharing. ExcelR
ReplyDeleteI feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
ReplyDeleteExcelR Business Analytics Course
Very nice blog here and thanks for post it.. Keep blogging...
ReplyDeleteExcelR data science training
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
ReplyDeleteData science
This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this.. best data science course in bangalore
ReplyDeleteReally impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing.
ReplyDeletedata analytics courses
data science interview questions
business analytics courses
data science course in mumbai
The information provided on the site is informative. Looking forward more such blogs. Thanks for sharing .
ReplyDeleteArtificial Inteligence course in Faridabad
AI Course in Faridabad
wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
ReplyDeleteData science Interview Questions
Cool stuff you have and you keep overhaul every one of us
ReplyDeletedata science course
wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
ReplyDeleteData Science Course
Attend The Business Analytics Courses From ExcelR. Practical Business Analytics Courses Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analytics Courses.
ReplyDeleteBusiness Analytics Courses
wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
ReplyDeletedata analytics course in Bangalore
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
ReplyDeleteSimple Linear Regression
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
data science interview questions
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
data science interview questions
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
ReplyDeleteSimple Linear Regression
Correlation vs Covariance
Great information!! Thanks for sharing nice blog.
ReplyDeleteData Science Course in Hyderabad
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
data science interview questions
Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
ReplyDeleteSimple Linear Regression
Correlation vs Covariance
Attend The Course in Data Analytics From ExcelR. Practical Course in Data Analytics Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Course in Data Analytics.
ReplyDeleteCourse in Data Analytics
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
data science interview questions
Attend The Data Analyst Course From ExcelR. Practical Data Analyst Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analyst Course.
ReplyDeleteData Analyst Course
The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.data science course in Hyderabad
ReplyDeleteNumerous website admins are continually hoping to spare time by recruiting others to do physical work so they can concentrate more on promoting and refreshing their sites. database data entry services
ReplyDeleteAmazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple Linear Regression
data science interview questions
KNN Algorithm
I am really happy with your blog because your article is very unique and powerful for new reader.data science course in Hyderabad
ReplyDeleteAmazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteSimple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained
Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data science online course
ReplyDeleteAttend The Data Science Courses Bangalore From ExcelR. Practical Data Science Courses Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Science Courses Bangalore.
ReplyDeleteData Science Courses Bangalore
very well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple Linear Regression
data science interview questions
KNN Algorithm
Logistic Regression explained
Your work is very good, and I appreciate you and hopping for some more informative posts
ReplyDelete<a href="https://www.excelr.com/business-analytics-training-in-pune/”> Courses in Business Analytics</a> have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon…
I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job !
Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data science courses
ReplyDeletevery well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteLogistic Regression explained
Correlation vs Covariance
Simple Linear Regression
data science interview questions
KNN Algorithm
This Was An Amazing ! I Haven't Seen This Type of Blog Ever ! Thankyou For Sharing data science course in Hyderabad
ReplyDeletevery well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteLogistic Regression explained
Correlation vs Covariance
Simple Linear Regression
data science interview questions
KNN Algorithm
Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data science course in Hyderabad
ReplyDeleteAttend The Data Analytics Courses From ExcelR. Practical Data Analytics Courses Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analytics Courses.
ReplyDeleteData Analytics Courses
hello sir,
ReplyDeletethanks for giving that type of information. I am really happy to visit your blog.Leading Solar company in Andhra Pradesh
i am glad to discover this page : i have to thank you for the time i spent on this especially great reading !! i really liked each part and also bookmarked you for new information on your site.
ReplyDeleteData Scientist Course
I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors.
ReplyDeleteData Analytics Courses in Bangalore
I Want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging endeavors.
ReplyDeleteBusiness Analytics Course in Bangalore
Informative blog
ReplyDeleteData Science Course in Patna
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
ReplyDeletedata scientist course in hyderabad