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 March 31st, 2003, 05:40 PM
svelez svelez is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 8 svelez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dynamic XML Transformation

I was wondering if you know of any way/algorithm to dynamically build an XML Stylesheet in Java to transform an XML message. The scenario is that I want to dynamically inquire on XML message(s) by certain elements. The query can be different and any number of combinations. So I would like to translate the queries into XSL and then tranform the original XML message to return the appropriate data.

For example:
<company>
<employee>
<name>John Doe<name>
<SSN>123-45-6789</SSN>
</employee>

<employee>
<name>Jane Doe<name>
<SSN>987-65-4321</SSN>
</employee>

<employee>
<name>John Davis<name>
<SSN>111-11-1111</SSN>
</employee>

<employee>
<name>John Murphy<name>
<SSN>111-22-2222</SSN>
</employee>
</company>

Now if I I get a query for anyone named John, I would like build the apporpriate XSL to represent this and then tranform the XML above to return only the employees John (Doe, Davis, Murphy).

At the same time I want the same Java code to be able to dynamically build an XSL stylesheet if a query was made for anyone named John and has a SSN that starts with 111. So then I can use this XSL to transform the XML to only return John Davis and John Murphy.

I would appreciate any assistance. Thanks

Reply With Quote
  #2  
Old April 1st, 2003, 07:20 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Well, you can pass parameters to your xsl file to use during the transform, that might be easier than building a new style sheet each time. It does mean putting logic into your style sheet to determine when a value is set and when to use it, etc.

The other option would be to use a jsp (or similar java code that generates a string) as your style sheet. Then you can put your logic in the java code (if a first name was passed, include the snippet for sorting on first name, if a last name was passed, include the snippet for sorting last name), that idea.
__________________
-james

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Dynamic XML Transformation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway