table caption

  • 3 replies.
  • This is not yet resolved.
  • This question was started by Soren.
  • Last post by Carl.
Soren
member
April 27th 2009
I have a problem with inserting a caption tag inside a table tags. I have defined this schema for tables:

<xs:element name="table">
<xs:complexType>
<xs:sequence>
<xs:element ref="caption" minOccurs="0" maxOccurs="1" />
<xs:element ref="tr" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>

.. so when the cursor is inside a table I can click 'table' on 'status bar' at the buttom of the editor, and I have the option to 'add caption', however, when I do this I will get this error message: "The XSL output is not valid HTML. The element 'CAPTION' is not allowed inside the element 'TABLE'."

Is this a bug, or am I doing something wrong?

I think this is actually valid HTML and when in XML view I can actually add the caption..
Carl
Xopus Team
April 27th 2009
When the caption element is added it is apparently also outputted in the WYSIWYG view. The output needs to be valid XHTML, and it seems that there is a problem with the output when the caption element exists. What you can do is add the treeTransform in your <x:view>, to see the HTML being outputted:

<x:view name="WYSIWYG View">
<x:transform xsl="stylesheet.xsl"/>
<x:treeTransform/>
</x:view>

Check the HTML that you get. Otherwise output the caption in another way to make it valid XHTML in the output.

I hope this helps.
Soren
member
April 27th 2009
I can't have both an xsl-transform and a treeTransform in the same view.. (?)

But if I switch to the tree view I can see that the caption is inserted correctly (right after <table> and before first <tr>), and when I switch back to wysiwyg the caption is also displayed correctly. The error message only comes when the editor is in wysiwyg mode, so to me it seems a lot like a bug..
Carl
Xopus Team
April 28th 2009
In the Simple Demo a caption can be inserted. It is not outputted however, but by adding the following line to the stylesheet.xsl it is:


<xsl:template match="caption">
<caption>
<xsl:apply-templates />
</caption>
</xsl:template>

I see no problems with this. The caption element is outputted as a caption element, and it displays correctly.

With the views: make sure that the namespace is correct. Sometimes the x: prefix is not declared. The example I gave above first transforms the XML with the stylesheet.xsl, and then transforms that in to a tree-transform, an XML view.

Can you tell me what the caption looks like in the output of your xsl?

React

HTML will be shown as HTML code.
Linebreaks and Links starting with http:// are automatically resolved