For a Google Shopping feed I need to give Google some variables of products I have.
Case: There are 3 Unique Product Identifiers:
<!-- Unique Product Identifiers-->
<g:brand>{manufacturer}</g:brand>
<g:gtin>{upc}</g:gtin>
<g:mpn>{sku}</g:mpn>
And one way to say if it's true or false:
<g:identifier_exists>TRUE</g:identifier_exists>
The g:identifier_exists should be true of 1 of the 3 identifiers is filled in (not null/empty). If all 3 are empty then the identifier should be FALSE. Like this:
<g:identifier_exists>FALSE</g:identifier_exists>
Is this possible with XML?
EDIT: Someone mentioned XLST so I tried the following:
<item>
!-- Basic Product Information -->
<g:id>{sku}</g:id>
<title>{name,[substr],[70],[...]}</title>
<description>{description,[html_entity_decode],[strip_tags]}</description>
{G:GOOGLE_PRODUCT_CATEGORY}
{G:PRODUCT_TYPE,[10]}
<link>{url parent}</link>
{G:IMAGE_LINK}
<g:condition>new</g:condition>
<!-- Availability & Price -->
<g:availability>{is_in_stock?[in stock]:[out of stock]:[available for order]}</g:availability>
<g:price>{normal_price,[USD],[0]}USD</g:price>
{G:SALE_PRICE,[USD],[0]}
<!-- Unique Product Identifiers-->
<xsl:choose>
<xsl:when test=" g:brand != ''' ">
<g:identifier_exists>TRUE</g:identifier_exists>
</xsl:when>
<xsl:when test=" g:gtin != ''' ">
<g:identifier_exists>TRUE</g:identifier_exists>
</xsl:when>
<xsl:when test=" g:mpn != ''' ">
<g:identifier_exists>TRUE</g:identifier_exists>
</xsl:when>
<xsl:otherwise>
<g:identifier_exists>FALSE</g:identifier_exists>
</xsl:otherwise>
</xsl:choose>
<!-- Apparel Products -->
<g:gender>{gender}</g:gender>
<g:age_group>{age_group}</g:age_group>
<g:color>{color}</g:color>
<g:size>{size}</g:size>
<!-- Product Variants -->
{G:ITEM_GROUP_ID}
<g:material>{material}</g:material>
<g:pattern>{pattern}</g:pattern>
<!-- Shipping -->
<g:shipping_weight>{weight,[float],[2]}kg</g:shipping_weight>
<!-- AdWords attributes -->
<g:adwords_grouping>{adwords_grouping}</g:adwords_grouping>
<g:adwords_labels>{adwords_labels}</g:adwords_labels>
</item>