XML : XSL translator which removes blank space and convert inches to feet

I need XSL which can do following things:-

  1. Remove all empty attributes
  2. Any attribute which has UOM in name and value is IN i need to change its value to FEET
  3. All the attributes which contain Length, Width, Height in name i need to convert values to feet (need to multiple by .083)

For my first requirement i am using this xsl:-

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">      <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8"/>      <xsl:template match="node()|@*">          <xsl:copy>              <xsl:apply-templates select="node()|@*"/>          </xsl:copy>      </xsl:template>      <xsl:template match="@*[not(normalize-space(.))]">          <xsl:if test="descendant::*/@*[not(normalize-space(.))]">              <xsl:copy />          </xsl:if>      </xsl:template>  </xsl:stylesheet>    

Input you can assume something like:-

  <Input BlankAttribute="" HeightUOM="IN" Height="1" WidthUOM="IN" WIdth="2" RandomAttribute="random"/>    

No comments:

Post a Comment