xsl-list
[Top] [All Lists]

Re: [xsl] Moving (promoting) XML elements through XSL

2006-06-30 07:46:54
You've been a great help, David. I have one last question (for you or
the list), if you don't mind. I'm going to next my topic elements.

For example:

<?xml version="1.0"?>
<topic>
   <title>
      <indexterm>Software Requirements</indexterm>Software Requirements
   </title>
    <prolog>
          <metadata>
             <keywords>
                <indexterm>
                   <indexterm>Software Requirements</indexterm>
                </indexterm>
             </keywords>
          </metadata>
    </prolog>
   <body>
      <p>Some sample text</p>
   </body>

  <topic ..>
     ..
      <topic ..>
       ..
      </topic>
  </topic>
</topic>

How would I include the topic subnodes in my output?  Your suggestion
to process my title, insert prolog, and then process body, worked like
a charm for the input XML I gave you. But of course, my nested topic
elements don't appear in the output.

I tried adding a statement to select everything that wasn't a title,
indexterm, or body element (namely, the nested topic), but I either
encountered errors about inserting attributes after an element was
processed, or the apply-templates statement didn't make any difference
in the output.

                      <xsl:apply-templates select="@*"/>

Thanks,
Mark


process title, insert your prolog, then process body

so instead of

                       <prolog>
                       .....
                      </prolog>
                      <xsl:apply-templates select="node()"/>


do

                      <xsl:apply-templates select="title"/>
                       <prolog>
                       .....
                      </prolog>
                      <xsl:apply-templates select="body"/>

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--