"rwt:group" (RC-WinTrans Namespace)

 

<xsl:attribute name="rwt:group" namespace="RC-WinTrans">ResName</xsl:attribute>

 

"rwt:group" creates a group in the data structure used by RC-WinTrans.  A group is useful if the XML element has child elements to be grouped.  The structure of groups and child elements is visible in RC-WinTrans' Project Data view and can be a useful reference for translators.

 

Attribute value: the resource name of the group.  See Sample Code 2, below.  The resource name is visible in RC-WinTrans' Project Data view and is used to identify the group.

 

A resource name is not required (Sample Code 1) for a group element but there should be one if available (Sample Code 2).  A unique resource name ensures positive identification of the element in RC-WinTrans' update database process.

 

Related topics...

 

 

XML File to be Processed

 

<?xml version="1.0"?>

<materials>

  <material name="Alloy Steel" matid="3">

     <physicalproperties>

         <EX displayname="Elastic Modulus" value="0.21E+12" desc="none"/>

         <DENS displayname="Density" value="0.77E+04"/>

      </physicalproperties>

  </material>

</materials>

 

 

Sample Code 1: Group with NO Resource Name

XML parser (XSL file): XSL command ("xsl:attribute") to add the instruction attribute "rwt:group" to all <material> elements.  No resource name is specified for the group- the "rwt:group" attribute value is empty.

 

<!-- The element 'material'. Make a group and translate the attribute 'name' -->

 <xsl:template match="material">

  <xsl:element name="material">

     <xsl:attribute name="rwt:group" namespace = "RC-WinTrans"> </xsl:attribute>

     <xsl:apply-templates

               select="*|@*|text()|comment()|processing-instruction()"/>

  </xsl:element>

 </xsl:template>

 

^ Top ^

 

Sample Code 2: Group with Resource Name

XML parser (XSL file).  XSL command ("xsl:attribute") to add the instruction attribute "rwt:group" to all <material>  elements. A resource name is specified.

 

The resource name for <materials> elements is specified as fixed text ("Material matid=") plus the value of the <material> attribute "matid."

 

"Material matid=<xsl:value-of select="@matid"      (Result: e.g., "Material matid=6")

 

 <!-- The element 'material'. Make a group and translate the attribute 'name' -->

  <xsl:template match="material">

   <xsl:element name="material">

      <xsl:attribute name="rwt:group" namespace = "RC-WinTrans">
                        Material matid=<xsl:value-of select="@matid"
/>

          </xsl:attribute>

      <xsl:apply-templates

                select="*|@*|text()|comment()|processing-instruction()"/>

   </xsl:element>

  </xsl:template>

 

^ Top ^

 

Sample Code 3: Group with Translatable Attribute

XML parser (XSL file), same as Sample Code 2.  The <material> element attribute "name" is designated as translatable with the "rwt:elementTU" instruction attribute.

 

 <!-- The element 'material'. Make a group and translate the attribute 'name' -->

  <xsl:template match="material">

   <xsl:element name="material">

      <xsl:attribute name="rwt:group" namespace = "RC-WinTrans">
Material matid=<xsl:value-of select="@matid"/>

          </xsl:attribute>

           <xsl:attribute name="rwt:attributeTU_name"
namespace = "RC-WinTrans">
</xsl:attribute>

      <xsl:apply-templates

                select="*|@*|text()|comment()|processing-instruction()"/>

   </xsl:element>

  </xsl:template>

 

^ Top ^