Jump to content

Line Breaks in XSL


Intrigued

This topic is 7597 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi everyone, I'm hoping that someone can tell me how to use a line break in xsl. I have tried various code, but it only generates errors. Here is my code...

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns="http://www.w3.org/TR/REC-html40" result-ns="">

<xsl:template match="/"><xsl:apply-templates select="SQL/Result" order-by="@StockNumber"/></xsl:template>

<xsl:template match="Result">

<OPTION>

<xsl:choose>

<xsl:when test=".[TempStockOut='Y']">

<xsl:choose>

<xsl:when test=".[stockIDAndDescription='Y']">

<xsl:attribute name="value"><xsl:value-of select="ItemID"/></xsl:attribute><xsl:value-of select="StockNumber"/> (<xsl:value-of select="DescriptiveName"/>) $<xsl:value-of select="JewellerPrice"/> [sold Out]

</xsl:when>

<xsl:otherwise>

<xsl:attribute name="value"><xsl:value-of select="ItemID"/></xsl:attribute><xsl:value-of select="StockNumber"/> $<xsl:value-of select="JewellerPrice"/> [sold Out]

</xsl:otherwise>

</xsl:choose>

</xsl:when>

<xsl:otherwise>

<xsl:choose>

<xsl:when test=".[stockIDAndDescription='Y']">

<xsl:attribute name="value"><xsl:value-of select="ItemID"/></xsl:attribute><xsl:value-of select="StockNumber"/> (<xsl:value-of select="DescriptiveName"/>) $<xsl:value-of select="JewellerPrice"/>

<xsl:attribute name="newline"><xsl:value-of select="newline"/></xsl:attribute>

</xsl:when>

<xsl:otherwise>

<xsl:attribute name="value"><xsl:value-of select="ItemID"/></xsl:attribute><xsl:value-of select="StockNumber"/> $<xsl:value-of select="JewellerPrice"/>

</xsl:otherwise>

</xsl:choose>

</xsl:otherwise>

</xsl:choose>

</OPTION>

</xsl:template>

</xsl:stylesheet>

Link to comment
Share on other sites

You can type the code with line breaks, but if you are having difficulties making the stylesheet work with the line breaks, remove them.

My text editor will "optimize" the code (remove the line breaks).

Link to comment
Share on other sites

This topic is 7597 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.