dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Home » Tip Bank » XML » XSLT
Language: XSLT
Expertise: Beginner
Aug 9, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Using Parameters in XSL Select Statements

Question:
Given the XML file:

 
Sometimes we want to display name1 and sometimes name2. We figured that perhaps we could set a parameter.
Then we could pass in the name of the attribute as the value using the addparameter method on the processor object. Then maybe we'd access the required attribute like this:

  
or "@$temp" but you get the idea)

Answer:
You've got the right idea, though it's not quite that simple. What you need to do is pass the name of the parameter, then compare against the name:





By including the select statement in the parameter, you guarantee that if no parameter is passed that the first name will always be used.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date