Summary: | [Chameleon - doc builder] how to handle <cr> during reprocessing of widget doc | ||
---|---|---|---|
Product: | Chameleon | Reporter: | Chris Thorne <cthorne@dmsolutions.ca> |
Component: | AutoDoc | Assignee: | Chris Thorne <cthorne@dmsolutions.ca> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | chameleon-dev@lists.maptools.org |
Priority: | P1 | ||
Version: | 1.99 | ||
Target Milestone: | 2.0 RC 1 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Chris, I think that XML ignores whitespace as a general rule. Since we are using the xml parser that is built into php, I am not sure we can change how it works. I believe that if you want to preserve <cr> then you will need to use the CDATA syntax. Bill, there may be an option for the xml parser regarding whitespace, you should check that first.
Looking at this one now.
Ok, it appears the only way to make this work properly is to use CDATA. i.e. <![CDATA[ <bob test="1" att1="1" att2="2"> <next>level</next> </bob> ]]> This works very well with the Help Viewer. Unfortunately the CDATA tags get blown away by the XML parser in PHP4. This problem sounds like it is fixed in PHP5. No help there unless we are going to PHP5.........Paul? ;) Talked with Chris. It appears that the XSLT can handle this by defining a few new rules. Assigning to him.
My proposal to this issue after thinking about it. Is to define a child schema for <cham:code></cham:code>. Here is the change to the schema: <xs:complexType name="CodeValue"> <xs:choice> <xs:element name="line" type="xs:string" maxOccurs="unbounded" minOccurs="1"/> <xs:element name="comment" type="xs:string" maxOccurs="unbounded" minOccurs="0"/> <xs:element name="code" type="cham:CodeValue" maxOccurs="unbounded" minOccurs="0"/> </xs:choice> </xs:complexType> I will then modify the xslt to define the <cr> with this ascii decimal code 
. I will let you know how this works out shortly.
Ok after much effort trying to be the most optimal method to define <cr> and having issues with the slt translator, and then the css file I got it to work. :) <xs:complexType name="CodeLine"> <xs:sequence> <xs:element name="line" type="xs:string" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="bold" type="xs:boolean" use="optional" default="false"/> </xs:complexType> within example and tag elements had to define <cham:code> as: <xs:element name="code" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="codeblock" type="cham:CodeLine" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> In the xslt's it the code section was defined as followes: <!-- ~~~~~~~~~~~ --> <!-- Code Section --> <!-- ~~~~~~~~~~~ --> <pre class="CodePreview"> <xsl:for-each select="cham:code"> <xsl:for-each select="cham:codeblock"> <xsl:for-each select="cham:line"> <xsl:if test="../@bold ="false""> <xsl:apply-templates /><br /></xsl:if> </xsl:for-each> <xsl:for-each select="cham:line"> <xsl:if test="../@bold ="true""> <span class="CodeRequired"><xsl:apply-templates /></span><br /></xsl:if> </xsl:for-each> </xsl:for-each> </xsl:for-each> </pre> You can currently view these changes with only the MapSize.en-ca.doc.xml since it is currently the only valid doc with the new schema. I will be updateing others shortly.