This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using the xsl:if correctly



> desired XSL:
> ???

who knows?

Your question wasn't very explict 
If the question is how to get from the "current XSL" to the
"desired XML" why does the `current XSL' generate the html
markup <td> <INPUT etc that isn't in your desired output.

However beware your test
<xsl:if test="@in_textarea">
is true if the current element has an in_textarea attribute, even if it
has the value "false".

probably you want something like

bash-2.01$ xt col.xml col.xsl
<?xml version="1.0" encoding="utf-8"?>

<column name="model" type="String" description="Auto Model" field_type="textbox">Mustang</column>
<column name="vintag" type="String" description="VIN Number" field_type="textarea">abc</column>



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                >

<xsl:output method="xml" indent="yes"/>

<xsl:template match="column">
 <xsl:copy>
  <xsl:copy-of select="@*[not(starts-with(name(.), 'in_'))]"/>
  <xsl:attribute name="field_type">
     <xsl:value-of 
         select="substring-after(name(@*[starts-with(name(.), 'in_')
           and normalize-space(.)='true']),'in_')"/>
  </xsl:attribute>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>


</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]