473,382 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XSLT question

1
I have a question about an xslt I want to make. The xml looks like :

<tag1>
<value1>xx</value1>
</tag1>

<tag2>
<value2>yy</value2>
</tag2>

I want some transformations on <value2> in <tag2> depending on <value1> in <tag1> (in my case depending on whether
<value1> contains an empty string or not).

Is this possible in xsl and if so how can it be done ?

Thx
Jun 13 '07 #1
2 1007
dorinbogdan
839 Expert 512MB
Welcome to TheScripts TSDN,


I think that it's possible, but I'm not sure what you want to change the value2 tag name or tag value.
However, please take a look at this XSL reference.
You may need to use <xsl:copy-of> and <xsl:value-of> statements if want to generate a different XML file.

Just try to play with XSL code and then come back if have questions.
We cannot provide full source code, just suggestions and snippets (these are the site rules).

Dorin.
Jun 13 '07 #2
Yes it is possible. What you need to do is something like this:

<xsl:if test="tag1/value1">
change the value of value2
</xsl:if>

now this is if tag1/value1 is not the child of any other node. If it is, you need to include the complete path. Unless it's in a for loop. Then you would start the path only after the node that is in the for-each.
Hope that helps.
Jun 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
0
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
0
by: DAnne | last post by:
Hi, I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols. I have to do a tally report. This report is divided up into sections....
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
15
by: Jeff Uchtman | last post by:
Can I draw from 2 XML sources, the structure is exactly the same execpt for data contained into 1 xslt using math to add some structrure, and displaying others as node 1 and node 2? This data is...
2
by: MichaelRKramer | last post by:
Hi, I'm new to dotnet 2.0, but I'm an expert in asp 3 or classic asp. Most of my sites are all done with XSLT and ASP which basically writes XMLs. Now I'm reading about the new cool stuff in...
14
by: Lee | last post by:
I have a xml file, here is sample part: <?xml version="1.0" encoding="UTF-8"?> <ProducsList> <Product id="1"> <SpecList> <Spec> <SpecLabel>Height</SpecLabel> <SpecValue>10</SpecValue>...
1
by: nayijitu | last post by:
Hi, I need some thing like this. I have an XML file and it contain some elements(tag) with a proper hierarchy... In that XML a particular element <page> contain some child node element like...
2
by: astroboiii | last post by:
New to the whole xml thing and finding w3schools to be an excellent resource. Now down to my question: I have several xml files I need to parse through and grab relevant information from and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.