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

clever ways to dynamically copy/create element structu

Subject: clever ways to dynamically copy/create element structure as needed?
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Oct 2022 16:28:18 -0000
 clever ways to dynamically copy/create element structu
Hi everyone,

I want to use XSLT to add a piece of <data> metadata to a DITA topic. The DITA
content model lets me place it at "topic/prolog/metadata/data":

<topic id="topic">
  <title>My Topic</title>
  <prolog>
    <metadata>
      <data name="prefix">my-prefix</data>
    </metadata>
  </prolog>
  <body/>
</topic>

Some, none, or all of the required "prolog/metadata" element structure might
already exist:

<topic id="topic">
  <title>My Topic</title>
  <body/>
</topic>

<topic id="topic">
  <title>My Topic</title>
  <prolog>
    <author type="creator">chrispy</author>
    <metadata>
      <keywords>
        <indexterm>some term</indexterm>
      </keywords>
    </metadata>
  </prolog>
  <body/>
</topic>

My current XSLT code to do this is embarrassing.

Does anyone have a favorite way of adding an element at a particular hierarchy
path, copying existing levels and creating missing levels as needed?

(This is just an example. I have other scenarios that require deeper element
structures.)

Thanks!

-----
Chris Papademetrious
Tech Writer, Implementation Group
(610) 628-9718 home office
(570) 460-6078 cell

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-2013 All Rights Reserved.