Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts

    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

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Code:
    //text/*[name()!='h3']
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • Users who have thanked shyam for this post:

    ahallicks (11-18-2008)

  • #3
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •