Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 1st, 2013, 09:16 AM
Registered User
 
Join Date: Jul 2013
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Default How to define XSLT tag for particular element only

Hi,

please see my xml below for which I m trying to generate HTML.

<section>
<title>Phonemic Awareness</title>
<img src="imagelibrary/hear.tif"></image>
<p><b>Use the Poetry Poster</b></p>
<p>Distribute it</p>
</section>

I want to apply <b> tag in XSLT where I have <p> in my XML file, but as you can see in sample XML file, I have <p><b> tag also which I don't want to be affected.. In short, I want it to be apply only to <p> tag.

Can you please help me...
 
Old August 1st, 2013, 10:48 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can write specific match patterns like match="p[b]" which matches any p element that has a b child, or match="p/b" which matches any b element that has a p parent.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
XSLT_Prof (August 1st, 2013)
 
Old August 1st, 2013, 11:12 AM
Registered User
 
Join Date: Jul 2013
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks you





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT output to HTML - xml element text should look exactly as laid out in xml element DjGogga XSLT 4 July 21st, 2011 05:39 PM
Increment tag by 1 using XSLT Divya XSLT 10 April 13th, 2010 05:39 AM
How to find no.of childnodes of a tag element? sachin635 .NET Framework 3.5 0 September 15th, 2008 04:32 AM
How to use xsl:element tag??? NewToXSL XSLT 2 June 8th, 2006 05:54 PM
define location for file input tag bleitner Javascript 6 August 21st, 2004 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.