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:
  #1  
Old March 24th, 2004, 02:38 PM
famdylan famdylan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 famdylan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to famdylan
Question xml transformations

I am new to transforming xml with xsl so maybe someone can help me

below is the xml i am getting from a web service.

basically I want to write a xsl page to transform that and select only structs that have a
<member>
<name>status</name>
- <value>
<string>Syndicated</string>

Does that make any sense? Even someone pointing me to the right tutorials would be a big help thanks!!

Code:
   <?xml version="1.0" encoding="iso-8859-1" ?> 
- <methodResponse>
- <params>
- <param>
- <value>
- <array>
- <data>
- <value>
- <struct>
- <member>
  <name>sitename</name> 
- <value>
  <string>http://www.xblocks.com/contentPortal/weblog</string> 
  </value>
  </member>
- <member>
  <name>siteurl</name> 
- <value>
  <string>http://www.elevenprospect.com/</string> 
  </value>
  </member>
- <member>
  <name>dataurl</name> 
- <value>
  <string>http://cp.elevenprospect.com/xblocks/xml.jsp?portal=www.xblocks.com/contentPortal/weblog&filterName=name&filterValue=.*</string> 
  </value>
  </member>
-<member>
  <name>status</name> 
- <value>
  <string>Syndicated</string>  
  </value>
  </member>
- <member>
  <name>description</name> 
- <value>
  <string>ElevenPropsect</string> 
  </value>
  </member>
- <member>
  <name>faultCode</name> 
- <value>
  <string>0</string> 
  </value>
  </member>
- <member>
  <name>faultString</name> 
- <value>
  <string /> 
  </value>
  </member>
  </struct>
  </value>
  </data>
  </array>
  </value>
  </param>
  </params>
  </methodResponse>

Reply With Quote
  #2  
Old March 25th, 2004, 07:28 AM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
First off, next time you post XML go to View->Source and paste that instead so you don't paste all of those stupid "-" characters that are not truly part of the XML. The XSL that I am about to present to you makes the ASSUMPTION that when you said "I want to write a xsl page to transform that and select only structs that have a <XML>" that what was meant by that was "struct elements that have one or more member elements."

Code:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
	<xsl:apply-templates select="methodResponse/params/param/value/array/data/value/struct[count(member) > 1]"/>
</xsl:template>

<xsl:template match="struct">
	<!-- process struct -->
	This struct has at least one member element.
</xsl:template>

</xsl:stylesheet>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xml transformations


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 6 hosted by Hostway
Stay green...Green IT