|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
hi
i have a doubt i have an xml input file ,it contains a container,in that container it contains different parameters ,from that i want to write code i have code in perl using xml input if($a!='value') { if($c=' ') { print error } if($d=' ') { print error } } from above code $a comes under one parameter ,it checks that parameter value is equals or not ,if condition is true it enters in to that condition and $c is second parameter it checks that whether the parameter value is null or not if it is null it will print error, and $d is the 3rd parameter in the same container it also checks wheter it is null r not same thing will happen, problem is how can i fetch the values from different parameters from the same condition,with in one condition,the values of $c and $d is not accessing from xml input actually i for got to tell that this above perl code should be convert in to xslt taking input from xml i need this code using xslt plz reply soon |
|
#2
|
|||
|
|||
|
If you mean how do you perform conditional processing in xslt, then you can use choose and when...
Code:
<xsl:choose> <xsl:when test="@attr = 'hello'"> <!-- do something ->> </xsl:when> <xsl:otherwise> <!-- do something else ->> </xsl:otherwise> </xsl:choose>
__________________
"Badges? We ain't got no badges. We don't need to badges! I don't have to show you any stinkin' badges!!" |
|
#3
|
|||
|
|||
|
thank u but i need different
Quote:
actually i tried this code but not displaying correctly so plz try it again |
|
#4
|
|||
|
|||
|
Quote:
actually wil u tell me that were u r taking the @attr value i have two different parameters values and i want check that in one if condition in above its there |
|
#5
|
|||
|
|||
|
If you posted the rest of your current code it might help.
|
|
#6
|
|||
|
|||
|
As jkmyoung has said, post your code (xslt) PLUS your xml. Then let us know exactly which piece you're having a problem with.
|
|
#7
|
|||
|
|||
|
Quote:
ok it is not possible to send code to u but i will explain xml code <container> <container arametervalues><container:enum>parameter1</container:enum> <container:value>data<container:value> <container:enum>parameter2</container:enum> <container:value></container:value> <container:int>parameter3</container:int> <container:value>3</container:value> <container:boolean>parameter4</container:boolean> <container:value>true</container:value> </container arametervalues></container> like this it contains 4 containers with same parameters with same or different values perl code if($parameter1!='data') { if($parameter2=' ') { print error } if($parameter3='3 ') { print error } } now based on these codes i need in xslt the problem is not fetching the values properly i tried different methods but its not coming plz reply as soon as possible ![]() |
|
#8
|
|||
|
|||
|
As mentioned already, please show the code (xslt) AND xml that you're having problems with. If you can't show the code for whatever reason, then show a sample which demonstrates your problem.
"Help us, help you." PS. Use the code tags to enclose your xml and xslt. |
|
#9
|
|||
|
|||
|
Quote:
what ever earlier is there it is sample code so i need to send the xslt code <xsl:if test="DEF= '/container/parameter1'"> <xsl:if test="VALUE != 'data'"> <xsl:if test="DEF= ''/container/parameter2'"> <xsl:if test="'VALUE' = ''"> error:the value is not configured </xsl:if> </xsl:if> <xsl:if test="DEF= ''/container/parameter3'"> <xsl:if test="'VALUE' = '3'"> error:the value is 3 </xsl:if> </xsl:if> </xsl:if> this code is not fetching the values properly from the xml u already have a code of xml and perl ,based on perl code we want to generate the output using xslt. plz reply soon ASAP |
|
#10
|
|||
|
|||
|
Please recheck your XML as it is not well formed...
Code:
<container>
<container:parametervalues>
<container:enum>parameter1</container:enum>
<container:value>data
<container:value>
<container:enum>parameter2</container:enum>
<container:value></container:value>
<container:int>parameter3</container:int>
<container:value>3</container:value>
<container:boolean>parameter4</container:boolean>
<container:value>true</container:value>
</container:parametervalues>
</container>
Also, within your XSL, where/what are 'DEF' and 'VALUE'? |
|
#11
|
|||
|
|||
|
Quote:
the code is not wrong it is like that only from that xml input we want to fetch the parameter values first we r checking that parameter1 is not equal to value 'data' if it is true then it going under if condition,then it checks empty r not if it is empty it prints error my xml code is like that only |
|
#12
|
|||
|
|||
|
Quote:
from xsl the def is a definition of parameter it taking from directly xml and value is extarcting the value of def parameter value |
|
#13
|
|||
|
|||
|
Quote:
My apologises, I used netbeans to format your xml which had a slightly interesting result. ![]() |
|
#14
|
|||
|
|||
|
Quote:
which type of result u got will u plz send that code, if i use netbeans software it will work plz reply soon |
|
#15
|
|||
|
|||
|
Quote:
netbeans won't make it work, but it is a handy tool that can help - especially when people don't use the code tags. In any case, I don't think your can achieve what you're after directly refering to the element names - instead you should use the position function with an off-set value to indicate whether you're talking about parameter1, value1, par |