Skip to main content
1-Visitor
April 3, 2018
Question

Creating new element in Stylesheet

  • April 3, 2018
  • 1 reply
  • 6477 views

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.

1 reply

16-Pearl
April 3, 2018

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.

1-Visitor
April 4, 2018

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.

16-Pearl
April 4, 2018

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.