[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Applying an XSLT-file to specific nodes within an XML

Subject: Applying an XSLT-file to specific nodes within an XML file
From: Mark Aussems <mark.aussems@xxxxxxxxx>
Date: Thu, 16 Jul 2009 21:22:08 +0100
 Applying an XSLT-file to specific nodes within an XML
Hi all,

Hopefully someone can assist me in solving a (probably rather basic) problem related to restricting the execution of an XSLT file to a specific part of an XML file.

My XML file looks like this (very simplified):

<mss>
      <msDesc>
              <msItem>
                      <title>AAAA</title>
              </msItem>
      </msDesc>
      <msDesc>
              <msItem>
                      <title>BBBB</title>
              </msItem>
      </msDesc>
      <msDesc>
              <msItem>
                      <title>CCCC</title>
              </msItem>
      </msDesc>
</mss>

I have written an XSLT file which transforms my entire XML into a nice HTML file. I would now like to restrict the XSLT file so that it ONLY transforms the <msDesc> nodes which have a <title> tag with the value 'AAAA'. So, in simpler terms, I would like to say to my XSL file:

1. Find all <msDesc> nodes which have a <title> tag with the value 'AAAA'.
2. Apply the following <xsl:template> transformations, but only to the <msDesc> nodes specified above.
3. [And then all my <xsl:template> transformations]


A possible solution to this would be to write a simple XQuery script to extract the relevant <msDesc> nodes and put them in a separate XML file, which can then be transformed. That requires a lot of manual labour (especially since my titles go from AAAA to PPPP...), so I was wondering whether there is a work-around or short-cut within XSL?

I hope this makes sense. I'm sure there's something obvious I'm missing...

Many thanks in advance,
Mark

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.