0

Stock should be converted to a numeric valueBy replacing {stock[1]} by "available " to 100, and "limited stock" to 10, "out of stock" to 0. The idea is to work with numeric values ​​and update stocks.

I am looking for someone that could handle the problem with this dynamic xml file

1
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Sep 24, 2024 at 9:09

1 Answer 1

0

In XSLT (1.0 or greater):

<xsl:template match="stock[.='available']">
  <stock>100</stock>
</xsl:template>

<xsl:template match="stock[.='limited stock']">
  <stock>10</stock>
</xsl:template>

<xsl:template match="stock[.='out of stock']">
  <stock>0</stock>
</xsl:template>

Combined of course with other rules to handle the rest of your content, which you haven't shown us.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.