How to match multiple xml tags separately?
I have an xml file that is organized like a book. The root tag is <book> and it has multiple <chapter> tags with multiple <section> tags, some nested, within each chapter. Each section has multiple tables, lists, paragraphs, etc.
What I'm trying to do is use xslt to parse this xml file and output it as html and eventually pdf, keeping basically the same structure that exists within the xml source file. The problem I'm having is that I don't know how to match a single chapter, section, table, etc. without also matching all of the others. For example, if I want to match on the first table in the xml source file, I also end up matching all of the others and they get merged all together in the output. I want to keep them separate from each other.
So my question is, how do you keep the xml elements separate when their match is exactly the same: <xsl:template match="book/chapter/section">, <xsl:template match="book/chapter/section/table">, etc.?
I know that this must be a trivial issue for experienced coders, but I'm not finding the answer. If anyone can point me in the right direction I would appreciate it.
Thank you,
Josh
|