XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 28th, 2008, 03:54 AM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Question Doubt in xslt

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

Reply With Quote
  #2  
Old April 28th, 2008, 07:52 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
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!!"

Reply With Quote
  #3  
Old April 28th, 2008, 11:05 PM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
thank u but i need different

Quote:
Originally Posted by atlantisstorm
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>





actually i tried this code but not displaying correctly so plz try it again

Reply With Quote
  #4  
Old April 28th, 2008, 11:30 PM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
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>





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

Reply With Quote
  #5  
Old April 29th, 2008, 12:32 PM
jkmyoung jkmyoung is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 490 jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 2 h 30 m 36 sec
Reputation Power: 52
If you posted the rest of your current code it might help.

Reply With Quote
  #6  
Old April 29th, 2008, 02:40 PM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
As jkmyoung has said, post your code (xslt) PLUS your xml. Then let us know exactly which piece you're having a problem with.

Reply With Quote
  #7  
Old April 30th, 2008, 12:31 AM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
As jkmyoung has said, post your code (xslt) PLUS your xml. Then let us know exactly which piece you're having a problem with.


ok it is not possible to send code to u but i will explain

xml code
<container>
<containerarametervalues>
<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>
</containerarametervalues>
</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

Reply With Quote
  #8  
Old April 30th, 2008, 07:30 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
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.

Reply With Quote
  #9  
Old May 4th, 2008, 11:53 PM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
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.



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

Reply With Quote
  #10  
Old May 5th, 2008, 05:27 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
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'?

Reply With Quote
  #11  
Old May 5th, 2008, 05:36 AM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
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'?



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

Reply With Quote
  #12  
Old May 5th, 2008, 05:38 AM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by mobbeena
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


from xsl the def is a definition of parameter it taking from directly xml and value is extarcting the value of def parameter value

Reply With Quote
  #13  
Old May 5th, 2008, 06:23 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
Quote:
Originally Posted by mobbeena
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

My apologises, I used netbeans to format your xml which had a slightly interesting result.

Reply With Quote
  #14  
Old May 5th, 2008, 06:26 AM
mobbeena mobbeena is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 mobbeena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
My apologises, I used netbeans to format your xml which had a slightly interesting result.


which type of result u got will u plz send that code,
if i use netbeans software it will work
plz reply soon

Reply With Quote
  #15  
Old May 5th, 2008, 07:15 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 622 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 7 h 28 m 48 sec
Reputation Power: 135
Quote:
Originally Posted by mobbeena
which type of result u got will u plz send that code,
if i use netbeans software it will work
plz reply soon

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