Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am no XSLT pro so any advice on this would be appreciated. See the following XSLT:
<xsl:attribute name="id"> mnu<xsl:call-template name="replace-string"> <xsl:with-param name="text"> <xsl:value-of select="@id" /> </xsl:with-param> <xsl:with-param name="from" select="' '"/> <xsl:with-param name="to" select="'-'"/> </xsl:call-template> </xsl:attribute>
Nicely formatted in the XSLT file but the final source code output has problems caused by the whitespace e.g.
<li id="
 mnu4079" class="
 nav1">
Is there anything I can do to cause the XSLT stylesheet to ignore the whitespace so that I can maintain the formatting in the XSLT file whilst still getting the HTML output I require?
This is a handy article I had saved somewhere -> http://www.ibm.com/developerworks/xml/library/x-tipwhitesp.html
there's strip-whitespace and preserve-whitespace ellments, and this can also be controlled to some degree by using xsl:text.
Hope this sets you off in the right direction! It's a pain to chose between readable input and readable/functional output.
Dan
<xsl:attribute name="id"><xsl:text>mnu</xsl:text><xsl:call-template name="replace-string">...snip...
Yes, instead of "mnu<xsl:...", do it like this (surround strings with the xsl:text element):
<xsl:attribute name="id"> <xsl:text>mnu</xsl:text> <xsl:call-template name="replace-string"> <xsl:with-param name="text"> <xsl:value-of select="@id" /> </xsl:with-param> <xsl:with-param name="from" select="' '"/> <xsl:with-param name="to" select="'-'"/> </xsl:call-template> </xsl:attribute>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Whitespace Issues
I am no XSLT pro so any advice on this would be appreciated. See the following XSLT:
Nicely formatted in the XSLT file but the final source code output has problems caused by the whitespace e.g.
Is there anything I can do to cause the XSLT stylesheet to ignore the whitespace so that I can maintain the formatting in the XSLT file whilst still getting the HTML output I require?
This is a handy article I had saved somewhere -> http://www.ibm.com/developerworks/xml/library/x-tipwhitesp.html
there's strip-whitespace and preserve-whitespace ellments, and this can also be controlled to some degree by using xsl:text.
Hope this sets you off in the right direction! It's a pain to chose between readable input and readable/functional output.
Dan
Yes, instead of "mnu<xsl:...", do it like this (surround strings with the xsl:text element):
is working on a reply...