Page 1 of 1

Allow background colour setting by namespace

Posted: Tue Feb 03, 2004 6:06 pm
by bobtarling
I've been attempting to amend the XSLT syntax to background highlight the XSLT template code. There seems to be no way to do this, I can only background highlight the specific keywords, not the entire tag that the keyword is in.

What I wanted was to highlight everything that is XSLT template code with a pale yellow background, very similar to the way that netbeans highlight java code embedded in a JSP.

My suggested solution is -

For XML (ie HTML) type syntaxes allow sections in the syn file for namespaces eg

namespace1
xsl

namespace2
xs

In Preferences->DocumentClasses->???->Colors add the same namespaces in the "item" box

If a namespace item is selected then only allow setting of the background colour.

Here is an example script where what you see in bold I would actually like to see with a pale yellow background. Howver the foreground colours I would still like to appear as defined in the syn file for different elements, attributes, quoted strings etc.

<CREATE_PERSONAL_CUSTOMER>
<CLIENT_STUB>
<INDIRECT_IDENTIFY>0</INDIRECT_IDENTIFY>
<STATUS>1</STATUS>
<DIRECT_PHONE>0</DIRECT_PHONE>
<DIRECT_MAIL>0</DIRECT_MAIL>
<DIRECT_FAX>0</DIRECT_FAX>
</CLIENT_STUB>
<PERSONAL_DETAILS>
<TITLE>
<xsl:value-of select="$title" />
</TITLE>
<FNAME>
<xsl:value-of select="$given-name" />
</FNAME>
<MNAME>
<xsl:value-of select="$other-given-name" />
</MNAME>
<SNAME>
<xsl:value-of select="$surname" />
</SNAME>
<SUFFIX>
<xsl:value-of select="$name-suffix" />
</SUFFIX>
<DOB>
<xsl:call-template name="convert-date">
<xsl:with-param name="date" select="$birth-date" />
</xsl:call-template>
</DOB>
<SEX>
<xsl:choose>
<xsl:when test="$gender='F'">1</xsl:when>
<xsl:when test="$gender='M'">2</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</SEX>
</PERSONAL_DETAILS>
</CREATE_PERSONAL_CUSTOMER>

(Sorry about the formatting - [ code ] and [ b ] tags don't work together on this forum)

Posted: Wed Feb 04, 2004 11:01 am
by bobtarling
I've just spotted and voted for additional attributes http://www.textpad.com/forum/viewtopic.php?t=3773 and regexp keywords http://www.textpad.com/forum/viewtopic.php?t=3846

I mention this here as they do relate to my request above.

If we had attributes available such as bold or underline then this could be used instead of background colour as I suggested above. Bold would be particularly good.

So the real request of this issue is to somehow allow display styles to cross cut eachother. I can see this as being difficult to generalize so I still think it should be specific to namespaces.

For namespace1 I should be able to set bold to true and foreground as default. For a list of standard xsl elements and attribues I should be able to set their foreground colour but leave the bold setting as default.

This would give me the entire tag in bold but the keywords inside colour coded.


I mention the regexp issue as this would be a part-fix for me. I could use this to set the background colour of the whole tag by defining just the keywords <xsl:.*> and </xsl:.*>. This would lose me any foreground highlighting of keywords within that tag though.