cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Creating new element in Stylesheet

Seanyorrsum
4-Participant

Creating new element in Stylesheet

Hi,

 

I am attempting to create new elements in my stylesheet, I created them by copying another element that has the same base properties I need, giving it a new unique name, and then saving it.

After creating them, they do not appear in my style sheet list, I need to unselect the 'Only elements in document' and 'Only elements in document type' options from the View menu in the Styler.

 

The new elements I have created I put into my template xml file, but when I open the template, the tags for the new elements are red with a strike through, I can type any text into them, and parser messages appear for each tag with the following:

 

Error: unknown element in start tag. There is no such element as 'newelement'

 

How can I incorporate these new elements I have created into my stylesheet so they work with my documents?

 

Thanks.

Sean.

9 REPLIES 9

If only it were that easy! You're missing a piece of the puzzle. XML, in Arbortext, requires an associate DTD or Schema. This is the "document type" that the option you found in Styler refers to. The DTD/Schema defines the allowable elements and where they are allowed to be used. This is what lets Arbortext apply and keep a valid, known structure to the document, e.g. when you hit enter and it prompts for which element to insert.

The process to add new elements is therefore like this:

  1. Edit DTD/Schema file and add appropriate element/attribute definition(s) and update existing element definitions to list where the new element(s) are allowed to appear.
  2. Create a new sample XML with the new element(s) and make sure it validates in Arbortext. Fix DTD/Schema if not.
  3. Edit Arbortext .DCF file, if required, to indicate behaviour for the new element(s).
  4. Edit Arbortext stylesheet to add the definitions for the new element(s); adjust as suitable for screen vs print.
  5. If using Windchill bursting, and if the new element(s) are structural, make sure to update the burst configuration to account for the new element(s).

There are other auxiliary configuration items than the above (e.g. profiling), but my list should cover the main ones.

HI, I was going to write and tell you that you have to start at the beginning, from the DTD. Add the new elements and/or attributes to the DTD you are using, and then update the .dcf file if required. then when you go to Styler the elements will appear. Gareth has described it perfectly so follow his guidelines and you will be fine. This being XML everything starts with the DTD or Schema and builds down from there.

Thanks for the reply Gareth.

 

Are there any resources for how to edit the DTD for my document type that I can follow through?

I have had a look in my DTD file before posting the original question, but found it to be quite bare and didn't see any references to the elements currently used in my stylesheet, so I figured it didn't have the configurations I needed to perform.

 

If it helps, I have attached the DTD associated with my XML templates (named to be a txt so that it can be attached).

Since my last reply, I have actually managed to find a somewhat understandable tutorial for creating a DTD, however, due to my lack of knowledge and true understanding, there a few things that aren't working as they should be.

 

I don't seem to be able to understand how attributes work and so far, haven't managed to add one to the DTD that works (for example I had to drop the lang='EN' attribute from my book tag in the template as I could not get the ATTLIST attribute to work).

My main issue is that my 'graphic' element is just a #PCDATA, so it is not opening a file explorer window to select an image to load into the XML document.

My other issue is that my DTD isn't setting the rules correctly, and whilst the elements in the context menu when adding new tags is now reduced to what I have defined (yay), any tag can be used in any space, and would like to understand how to restrict this down so certain tags can only go inside other certain tags.

 

Added my new DTD as a txt file for reference.

OK you're on the right track. The graphics will work once you add a few attributes for the filename, width, height, etc. Those are mapped in the .dcf file to allow the image selector function to recognise the graphic element. You should probably have a look at some DTD examples and/or tutorials. Arbortext ships with some but you may find them a bit complicated, if so have a look online for more examples. You should probably also associate a PUBLIC ID with your new DTD and use a catalog to map it across. That way Arbortext can autodetect the DTD for your XML.

Thanks for the reply again.

 

I have a DCF, and it appears to be able to handle graphic elements, and has the parameters set already.

dcf.png

I am trying to find tutorials and resources, but I am struggling to find ones that will help with what I am trying to accomplish, there is of course a lot of assumed knowledge with them.

And for the official PTC tutorials, I have found some one that directly state it is about DCF editing, but I do not have access to PTC University Precision LMS.

 

As for associating the DTD with my XML, I currently call out to it with this in my XML

<!DOCTYPE book PUBLIC "aimdoc.dtd">

Is there a better way of doing this?

Time to go old school and download a document. The best one, which is free if you have a PTC Arbortext License is go to support and then select reference documents. the document you are looking for is PTC Arbortext Document Types Guide. It covers DTDs, DITA, DCF files, and creating and editing a DTD. I have used it quite a bit and it is very descriptive with information and examples. I think better than a tutorial since you can just go to the info you need.

Now you have to associate the public identifier by going to your doctypes directory where the DTD is stored. There should be a catalog file there and using an ASCII editor, add the public identifier along with the location the DTD is stored. It could look something like this when you input it.

-- DTD files for Truck Operator Manuals Truck Service and Service Sections --
PUBLIC "-//Navistar//DTD Operation and Maintenance Manuals OPMAN5//EN" "VehicleOperatorManual/VehicleOperatorManual.dtd"

 

Good Luck

One last thing, your DTD that was included as text is not really a functioning DTD. It will not validate, you have two element definitions for title, Your Book element does not contain any sub elements that would lead you to having chapters, etc. so you could never get to any content. I think this is a framework that you need to develop out based on how you want your book to look. This is my quick observation looking at your DTD.

Top Tags