Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-18-2008, 09:26 AM   PM User | #1
ahallicks
Senior Coder

 
ahallicks's Avatar
 
Join Date: May 2006
Location: Lancaster, UK
Posts: 1,134
Thanks: 1
Thanked 57 Times in 55 Posts
ahallicks is on a distinguished road
Referencing A Node, But Not Another Node in XSL

Little hard to explain with the title of this one. Basically, I have an XML file that looks something like:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<page_xml>
	<header id="1">This is a major heading</header>
	<images>
		<image id="1">
			<alt>default image</alt>
			<src>path_to_images</src>
			<height>60</height>
			<width>60</width>
		</image>
	</images>
	<text_blocks>
		<text id="1">
			<h3>This is minor heading 1</h3>
			<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam augue ante, vehicula eu, mollis in, dictum tempus, felis. Sed eget diam. Curabitur sit amet tortor. Duis feugiat. Etiam erat dui, egestas molestie, eleifend nec, sagittis vel, turpis. Sed eget lorem. Nullam magna felis, hendrerit vitae, aliquet ut, porta sed, mauris. Donec eu justo ut nisi vestibulum tristique. Integer pulvinar. Aenean interdum, turpis eget posuere eleifend, orci mi tempus magna, ut accumsan est turpis id quam. Vestibulum ac nulla. Aliquam sed nisl. Phasellus quis tellus sit amet turpis venenatis aliquam. In quis eros. Vivamus a lorem in nulla venenatis vehicula.</p>
		</text>
	</text_blocks>
</page_xml>
This is used in conjunction with a text editor that saves the changed content into a copy of this XML file with the updated node. For the output I use a number of different XSL stylesheets in order to allow for a selection of layouts for a certain page. The problem I'm having is that I want to be able to reference ALL elements within a text_block, but NOT the h3.

In XSL how do you say give me the value of everything, but not the h3?
__________________
"write it for FireFox then hack it for IE."
Quote:
Originally Posted by Mhtml View Post
Domains are like women - all the good ones are taken unless you want one from some foreign country.
Reputation is your friend

Development & SEO Tools
ahallicks is offline   Reply With Quote
Old 11-18-2008, 03:45 PM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
Code:
//text/*[name()!='h3']
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Users who have thanked shyam for this post:
ahallicks (11-18-2008)
Old 11-18-2008, 05:19 PM   PM User | #3
ahallicks
Senior Coder

 
ahallicks's Avatar
 
Join Date: May 2006
Location: Lancaster, UK
Posts: 1,134
Thanks: 1
Thanked 57 Times in 55 Posts
ahallicks is on a distinguished road
You sir, are an absolute genius! Thank you very much!
__________________
"write it for FireFox then hack it for IE."
Quote:
Originally Posted by Mhtml View Post
Domains are like women - all the good ones are taken unless you want one from some foreign country.
Reputation is your friend

Development & SEO Tools
ahallicks is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:39 AM.


Advertisement
Log in to turn off these ads.