[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: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Oct 2022 17:50:10 -0000
Re:  clever ways to dynamically copy/create element  st
I don't have a specific sample and may not be clever. What I have done with
this is to match on the prolog element and then process by the pieces I expect
to be there. So checking for the various child elements of prolog. Test for
their existence and if not there insert what you want. You need to also have a
test that say at the topic/title element checks to see if there is a prolog
element, so you can create one if it isn't there.Sent from my Verizon, Samsung
Galaxy smartphone
-------- Original message --------From: "Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 10/1/22  10:02 AM  (GMT-08:00)
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re:  clever ways to
dynamically copy/create element structure	as needed?

I forgot to mention one fun aspect. Sometimes the content models are
order-specific:
B 
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)* }
B 
so when new levels are created, they must be ordered correctly within whatever
siblings might already exist.
B 


Chris
B 
B 


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?


B 
Hi everyone,
B 
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 btopic/prolog/metadata/datab:
B 
<topic id="topic">
B  <title>My Topic</title>
B  <prolog>
B B B  <metadata>
B B B B B  <data name="prefix">my-prefix</data>
B B B  </metadata>
B  </prolog>
B  <body/>
</topic>
B 
Some, none, or all of the required bprolog/metadatab element structure
might already exist:
B 
<topic id="topic">
B  <title>My Topic</title>
B  <body/>
</topic>
B 
<topic id="topic">
B  <title>My Topic</title>
B  <prolog>
B B B  <author type="creator">chrispy</author>
B B B  <metadata>
B B B B B  <keywords>
B B B B B B B  <indexterm>some term</indexterm>
B B B B B  </keywords>
B B B  </metadata>
B  </prolog>
B  <body/>
</topic>
B 
My current XSLT code to do this is embarrassing.
B 
Does anyone have a favorite way of adding an element at a particular hierarchy
path, copying existing levels and creating missing levels as needed?
B 
(This is just an example. I have other scenarios that require deeper element
structures.)
B 
Thanks!
B 
-----
Chris Papademetrious
Tech Writer, Implementation Group
(610) 628-9718 home office
(570) 460-6078 cell
B 



XSL-List
 info and archive

EasyUnsubscribe
 (by email)









XSL-List info and archive

EasyUnsubscribe
(by email)

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.