Showing posts with label DE. Show all posts
Showing posts with label DE. Show all posts

Using JSP variable in XSTL select



In a JSP I have the user language code (en, de, es, etc) stored in a variable. This value comes from the database.


In the other hand I have a XML file with all the values of the different languages, something like this:



<?xml version="1.0" encoding="UTF-8"?>
<language>
<en enable="false" />
<de enable="false" />
</emergency>


I am trying to use that variable in a XSTL select but nothing that I have tried works (and I tried a lot of crazy things):



<%@ taglib uri="http://ift.tt/Tb0L7s" prefix="c" %>
<%@ taglib uri="http://ift.tt/1gmwIFk" prefix="x" %>

<c:set var="USER_LANGUAGE" value="en" />

<c:import url="/languageData.xml" var="language" />
<x:parse xml="${language}" var="language" />

// work
// <x:if select="$language/en[@enabled = 'true']">

// don't work :(
<x:if select="$language/${USER_LANGUAGE}[@enabled = 'true']">
// magic
</x:if>


Looks like I'm missing something, any help will be very welcome.


Thanks!


Read more ...

SQL Inserting data in master table and then reference data in detail table



I have two table


MasterReg(MasterID,Revenue,Date,Desc) MasterID Identity field


DetailReg(DetailID,MasterID,NumValue) DetailID Identity field


I am trying to insert data from xmlstring using openxml



insert into MasterReg (Revenue,Date,Desc) Select Revenue,Date,Desc From OPENXML(....


this will insert 5 rows in my MasterReg table


DetailReg table contain 6 row for each of value inserted in MasterReg table ex... for MasterID=1 there will be Six DetailID in DetailReg table(Six Entry in DetailReg for one DetailReg Entry)


My XMl String is



<Root>
<Detail>
<Revenue>333300</Revenue>
<Date>21/6/2011</Date>
<Desc>desc text...</Desc>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
</Detail>
<Detail>
<Revenue>333300</Revenue>
<Date>21/6/2011</Date>
<Desc>desc text...</Desc>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
</Detail>
<Detail>
<Revenue>333300</Revenue>
<Date>21/6/2011</Date>
<Desc>desc text...</Desc>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
<NumValue value="56"/>
</Detail>
</Root>


I dont want to use cursor for this one...The first MasterReg entry done Successfully but i doesn't have idea about how to insert in DetailReg associated with master reg table... Both table at initial have no data in it..


Read more ...

parse a comma seperated string in different nodes #xslt 2.0



Below is the XML input:



<performer>
<assignedEntity classCode="ASSIGNED">
<id root="123"/>
<addr>219 city, state, DE, 199</addr>
<assignedPerson classCode="PSN">
<name>Last , First , Middle, 12345</name>
</assignedPerson>
</assignedEntity>
</performer>


Expected XML output:



<Provider>
<ID>12345</ID>
<FName>First</Fname>
<Lname>Last</Lname>
</Provider>


Please give a generalized solution, the above example that I gave does not have fixed text values, these are subject to change.


Thanks,


Read more ...