xsl-list
[Top] [All Lists]

Re: [xsl] Only output element when parameter value is not equal to blank (or null)

2007-02-01 05:03:49
Your suggestion worked for me.  Thanks, Martynas.


--- Martynas Jusevicius
<martynas(_dot_)jusevicius(_at_)gmail(_dot_)com> wrote:

Hi,

maybe this way?

<xsl:if test="$param">
  <Key>
    <xsl:value-of select="$param"/>
  </Key>
</xsl:if>

Martynas

On 2/1/07, Chris Coyle <chriscoyle(_at_)yahoo(_dot_)com> wrote:
Hello,
  I need to modify the following so the Key
elements
will only exist when there is a value assigned to
parameter.

  Thanks,
   Chris


<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:output method="xml"
omit-xml-declaration="yes"/>
    <xsl:param name="catalogName"/>
    <xsl:param name="productid"/>
    <xsl:param name="shortdesc"/>
    <xsl:param name="packsize"/>
    <xsl:param name="category"/>
    <xsl:param name="major"/>
    <xsl:param name="intermediate"/>
    <xsl:param name="minor"/>
    <xsl:param name="trueVendor"/>
    <xsl:param name="gtin"/>
    <xsl:param name="mpc"/>
    <xsl:param name="itemType"/>
    <xsl:param name="packSize"/>


<xsl:template match="/">
     <DataService>
        <Identity>
                <DirectoryPath>
                        <Directory
type="Enterprise">Alpha</Directory>
                        <Directory
type="User">admin</Directory>
                </DirectoryPath>
               
<Authentication>admin</Authentication>
        </Identity>

        <Transaction>
                <Command type="Query">
                        <MasterCatalogRecord
etype="Entity">
                                <ExternalKeys>
                                        <Key
name="MASTERCATALOGNAME"
type="string"><xsl:value-of
select="$catalogName"/></Key>
                                        <Key
name="PRODUCTID" type="string"><xsl:value-of
select="$productid"/></Key>
                                        <Key
name="SHORTDESC" type="string"><xsl:value-of
select="$shortdesc"/></Key>
                                        <Key
name="SUPCCATEGORY"
type="string"><xsl:value-of
select="$category"/></Key>
                                        <Key
name="SUPCMAJORCLASS"
type="string"><xsl:value-of
select="$major"/></Key>
                                        <Key
name="SUPCINTERMEDIATECLASS"
type="string"><xsl:value-of
select="$intermediate"/></Key>
                                        <Key
name="SUPCMINORCLASS"
type="string"><xsl:value-of
select="$minor"/></Key>
                                        <Key
name="MANUFACTURER"
type="string"><xsl:value-of
select="$trueVendor"/></Key>
                                        <Key
name="EXTERNAL_PRODUCT_CODE"
type="string"><xsl:value-of select="$gtin"/></Key>
                                        <Key
name="MFR_PRODUCT_CODE"
type="string"><xsl:value-of select="$mpc"/></Key>
                                        <Key
name="ITEM_TYPE" type="string"><xsl:value-of
select="$itemType"/></Key>
                                        <Key
name="PACK_SIZE" type="string"><xsl:value-of
select="$packSize"/></Key>
                                </ExternalKeys>
                        </MasterCatalogRecord>
                </Command>
        </Transaction>
     </DataService>
</xsl:template>

</xsl:stylesheet>






____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from
Yahoo! Answers users.


http://answers.yahoo.com/dir/?link=list&sid=396546091



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--