[Framers] Another Simple Structured App

rick at rickquatro.com rick at rickquatro.com
Thu Apr 7 14:14:14 PDT 2022


You can also go in the other direction. Input:

<?xml version="1.0" encoding="UTF-8"?>
<ScpiCommand ClassName="IPAddress"
             ClassLongName="IP Address"
             Overlapping="false"
             Lockable="false"
             Type="Query">
   <String>:SYSTem:COMMunicate:TCP:IP:ADDRess</String>
   <ClassDescription>Outputs the IP address of the Ethernet
interface.</ClassDescription>
</ScpiCommand>

XSLT stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
    exclude-result-prefixes="xs math"
    version="3.0" expand-text="yes">
    
    <xsl:output indent="yes"/>
    
    <xsl:template match="/ScpiCommand">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:attribute name="String" select="String"/>
            <xsl:attribute name="ClassDescription"
select="ClassDescription"/>
        </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>

Output (same as your original input):

<?xml version="1.0" encoding="UTF-8"?>
<ScpiCommand ClassName="IPAddress"
             ClassLongName="IP Address"
             Overlapping="false"
             Lockable="false"
             Type="Query"
             String=":SYSTem:COMMunicate:TCP:IP:ADDRess"
             ClassDescription="Outputs the IP address of the Ethernet
interface."/>




More information about the Framers mailing list