Project

Profile

Help

break

Added by Anonymous about 19 years ago

Legacy ID: #3421548 Legacy Poster: TruusLee (truuslee)

Hi, I want a line break in xhtml. With Saxon-B 8.6 I don't get what I want, namely <br /> This is wat I wrote in my xslt file: <xsl:template match="l"> <xsl:apply-templates /> <xsl:element name="br " /> </xsl:template>


Replies (3)

Please register to reply

RE: break - Added by Anonymous about 19 years ago

Legacy ID: #3422715 Legacy Poster: Michael Kay (mhkay)

You didn't say what output method you are using. If you use method="xhtml" then the output will be serialized according to the guidelines in the XHTML spec. The name attribute of xsl:element defines the name of the element node created in the result tree. Because this is of type QName, leading and trailing whitespace is stripped according to the XML Schema rules. The whitespace is not part of the element name, and it has no effect on the way in which the resulting element is serialized. Nice try though. Michael Kay

RE: break - Added by Anonymous about 19 years ago

Legacy ID: #3427345 Legacy Poster: TruusLee (truuslee)

Thank you for answering my question! output method is "xhtml". My understanding of well-formed xhtml is that a line break should look like this: blablabla <br /> How do I get this with xslt???

RE: break - Added by Anonymous about 19 years ago

Legacy ID: #3427415 Legacy Poster: Michael Kay (mhkay)

Please apply this stylesheet to any input document: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xhtml"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>test</title></head> <body>line one<br/></body> </html> </xsl:template> </xsl:stylesheet> The output is: <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>test</title> </head> <body>line one<br /></body> </html> Perhaps you were having problems because the br element was not in the XHTML namespace? Michael Kay

    (1-3/3)

    Please register to reply