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

Re: clever ways to dynamically copy/create element st

Subject: Re: 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 17:02:11 -0000
Re:  clever ways to dynamically copy/create element  st
I forgot to mention one fun aspect. Sometimes the content models are
order-specific:

topic = element topic { title, titlealts?, (shortdesc | abstract)?, prolog?,
body?, related-links?, topic* }
prolog = element prolog { author*, source?, publisher?, copyright*,
critdates?, permissions?, (metadata | change-historylist)*, resourceid*, (data
| sort-as | data-about | foreign | mathml | svg-container | unknown)* }
metadata = element metadata { audience*, category*, keywords*, prodinfo*,
othermeta*, (data | sort-as | data-about | foreign | mathml | svg-container |
unknown)* }

so when new levels are created, they must be ordered correctly within whatever
siblings might already exist.


  *   Chris


From: Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, October 1, 2022 12:28 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  clever ways to dynamically copy/create element structure as
needed?

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

XSL-List info and
archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__
;!!A4F2R9G_pg!a7r1m9ZqiV4eF0dRar7ijsLmZPDxguhK0RPYb5y02NTd6ZMhMJ-6OOgmwoGKssR
TCKpUEvPFIXTaNtIVe9rEW4v_YxwwyffaEgFRs9luLZH7nUeag425$>
EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu
b/xsl-list/3380743__;!!A4F2R9G_pg!a7r1m9ZqiV4eF0dRar7ijsLmZPDxguhK0RPYb5y02NT
d6ZMhMJ-6OOgmwoGKssRTCKpUEvPFIXTaNtIVe9rEW4v_YxwwyffaEgFRs9luLZH7nfTEHOTC$>
(by email<>)

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.