Every company I’ve worked with performs 3 distinct actions during their design process – Create, Review and Approve. Whether it’s 1 person doing all three or all three spread over 30 people – those steps are always around. After a design is approved there comes the Engineering Change Process. This can be called the ECR, ECN, ECO, DCR, ECRN, ECP, etc. – I’ll call it the EC today.
Traditionally, I’ve seen companies use a Word or Excel document as the container for all their EC information in EPDM. This does require mapping properties from EPDM to the Word/Excel doc which has been well documented here in the SOLIDWORKS Tech Blog.
What I want to focus on here is how to use an XML document instead of Word or Excel so let’s let our hair down and have some fun coding an XML Style Sheet…. OK, ok that’s not really possible, but it’s also not that hard so read on.
XML is nothing more than a vehicle to display the Data Card variables. Since it’s the vehicle and not the container, all of the information you would enter in the Word/Excel document now goes on the Data Card so get ready to learn about maximizing space and making lots of Variables. Learn to use Tab controls as they’re perfect for space consolidation. *** Excessive use of Data Card variables can be hazardous to your health so be smart about how many controls you put on the Data Card ***
Now that you have your Data Card laid out, you’ll need to add the XML mappings. This is no different than mapping SOLIDWORKS or Word documents.
Block name = xml
Attribute name = EC/ECNumber (XSL Template Name/XML Attribute name – explained below)
File extension = xml
Once you have your Data Card and variables completed, then the fun starts as you prepare your XML Template and XSL Style Sheet. For our purposes today, these will be called ECTemplate.xml and EC.xsl respectively.
A few words about these two files…
The ECTemplate.xml is the vehicle so the variable mappings you defined earlier will go here and the EC.xsl is the body that makes it look good. Now, you may be asking, if that’s the vehicle, how do I drive my XML and XSL documents? If you aren’t, then you should. You can go complete minimalist and use Notepad – which I’ve used at customer sites in a pinch. I personally prefer Notepad++ as it’s free, provides enough extra tools and visual feedback to make it easy to edit (https://notepad-plus-plus.org/download/v6.8.html). There are dozens of HTML/XML editing tools available. Also, if you’re new to HTML coding, http://www.w3schools.com is a great on-line source to look up what tags mean and test them out.
You can clearly see the variables listed out as XML tags. You have to have the close tag </ECNumber> for each variable and your syntax has to be dead on so get ready to do a lot of copy/paste.
Notice the second line is pointing to the EC.xsl Style Sheet. If the ECTemplate.xml is the vehicle, then the EC.xsl is the body styling and dashboard. This is where you can fall down the layout rabbit hole with endless adjustments to the “look” of the XML document. I prefer something more than a black/white Model T so I’ve added colors to mine.
Look for the <xsl:value-of select=”ECNumber”/> tag in the HTML code and that’s what pulls in the variable. Most everything else is straight up HTML code for tables, rows and table cells.
Once you have it all done your result will display in the Preview tab.
What are the benefits of using XML over Word or Excel?
• No files to open
• Preview tab is instant and prints nicely
• XML files are a few KB in file size compared .25MB for some Word/Excel
• Setting up EPDM Template, Data Cards and Variables are no different
• Add some color and style to EPDM
• Word/Excel require a macro to update variables
Why would you not use XML?
• You require lots of formatting in Word for your needs
• You’re using Excel with lots of formulae (although this might be accomplished in XML)
• You have dynamic needs
o Drawings Affected for instance could be 2 or 20 and you need to allow the users to define it. Data Cards are static
• Your EC input requires 100s of fields of information
o Data Cards with too many variables will have performance implications
• Your corporate people are really just stuck in the mud of yesteryear and would prefer paper