Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Chris Coyle <chriscoyle@--------->
To:
Date: 2/1/2007 11:52:00 AM
I tried:
                                              <xsl:if
test="exists($productid)">
					   <Attribute name="PRODUCTID"
type="string"><xsl:value-of
select="$productid"/></Attribute>
					</xsl:if>

but got the following error:
06:47:27.062 global (ERROR) - Uncaught Exception:
'exists' is not a valid XSLT or XPath function.

-->exists($productid)<-- (line: 27, file:
file://C:\tibco\gi\3.1\GI_Builder.hta)
    at jsx3.xml.Processor.transform()
    at jsx3.xml.Entity.transformNode()
    at buildquery()
    at eg.service#callRouteAction()

I will try your suggestion.  Thanks for your reply.


--- Martynas Jusevicius
<martynas.jusevicius@xxxxxxxxx> 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@xxxxxxxxx> 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
> 
> 



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent