D
D
Dima2018-09-04 10:49:15
Programming
Dima, 2018-09-04 10:49:15

How to send a letter correctly?

Hello. I would be glad if you read it)
The backend gave me variables, in which the data is from the form. you need to put them on a board. There may be several data on the product with its characteristics and products.
if I wrap td in a variable, you will output correctly: two characteristics will output two td with their values

<xsl:for-each select="Product">
                    
                <td   style="border-bottom:1px solid #cccccc; text-align: center; padding: 40px 0 ">   
                    <strong>
                      <xsl:value-of select="@Qty"/>
                    </strong>
                </td>
                   </xsl:for-each>

but I need to output also a string (tr). I thought everything was obvious, just add tr in the first loop like this:
<xsl:for-each select="Product">
                     <tr>
                <td   style="border-bottom:1px solid #cccccc; text-align: center; padding: 40px 0 ">   
                    <strong>
                      <xsl:value-of select="@Qty"/>
                    </strong>
                </td>
                   </xsl:for-each>
but empty messages are coming. tried to replace it with a variable with the same value, but it comes as if it's just text, not a tag. how can i connect string output? <tr>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-09-04
Dolgoter @SpiderPigAndCat

You have a tr tag without a closing pair. xslt markup does not forgive this.
Do either this:

<tr>
 <xsl:for-each select="Product">
......
</xsl:for-each>
</tr>

Either like this:
<xsl:for-each select="Product">
<tr>
......
</tr>
</xsl:for-each>

If the business logic is tricky and you can't get away with one for-each, call another template inside the tr content.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question