Auslesen der Component- Koordinaten aus einem CAD File

Diese XSLT- Script transformiert Namen und 3D Koordinaten aus dem CAD File in ein JSON- Format :

<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:my="http://www.mentor.com/harness/Schema/bridgesharness" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="/"> cnum_coords = { <xsl:apply-templates select="/my:harnessdesign/my:wiringconnectivity/my:connector" /> }</xsl:template> <xsl:template match="/my:harnessdesign/my:wiringconnectivity/my:connector"> <xsl:for-each select="."> "<xsl:value-of select="./@displayName"/>" : <xsl:apply-templates select="/my:harnessdesign/my:harness/my:node"> <xsl:with-param name="msgcode"><xsl:value-of select="./@nodeid"/></xsl:with-param > </xsl:apply-templates> </xsl:for-each> </xsl:template> <xsl:template match="/my:harnessdesign/my:harness/my:node"> <xsl:param name="msgcode"/> <xsl:for-each select="."> <xsl:if test="@id = $msgcode"> { "node" : "<xsl:value-of select="$msgcode"/>", "pos" : <xsl:apply-templates select="my:Position"/> } </xsl:if> </xsl:for-each> </xsl:template> <xsl:template match="my:Position"> { "x" : <xsl:value-of select="@x"/> , "y" : <xsl:value-of select="@y"/> , "z" : <xsl:value-of select="@z"/> } </xsl:template> <xsl:template match="text()|@*"> </xsl:template> </xsl:stylesheet>