SGMLXML.net A place for SGML and XML application developers.

December 21, 2005

Strange things when you forget the namespace!

Filed under: XSLT — cangione @ 9:49 pm

When your XSLT stylesheet seems to be doing strange things remember to
check the root element for a namespace. I banged my head against the
wall tonight for a good hour trying to figure out why I was getting
such strange results from simple template matches. If I did a match on
a wildcard like * it worked fine but if I did a specific match or xpath
expression nothing was coming back!

Example:

<myroot element xmlns="http://bogus.com/xmlbeans">
<some_elements/>
</myroot> 

Once you remember to check the root for a namespace life is fairly
simple just declare the namespace:

Stylesheet:

<xsl:stylesheet
                        xmlns:bogus="http://bogus.com/xmlbeans"
                        xmlns="http://bogus.com/xmlbeans">
</xsl:stylsheet>

Note that I declare the namespace twice. Once so I can address
it in the input file as "bogus:<some_element>" and then as the
default namespace for the resulting file so I don't have namespaces
declared all over the place.

December 20, 2005

Toggle colors on html span element using Javascript

Filed under: CSS,DOM,XSLT — cangione @ 11:31 pm

Javascript for changeing the color of span elements with a particular class attribute.

<script type="text/javascript">
function changecolor() {
for (i=0;i<document.getElementsByTagName("span").length; i++) {
if (document.getElementsByTagName("span").item(i).className == "myclass"){
document.getElementsByTagName("span").item(i).style.color = "green";
}
}
}
</script>

.......

<a href="#" onclick="changecolor();">Change Color</a>

.......

<span class="myclass">Hi There</span>

December 4, 2005

VMware 5.5 Worth the Upgrade for Linux Hosts

Filed under: Linux,Software — cangione @ 9:48 pm

If you are running VMware on a Linux host it is worth the upgrade to
5.5 for the new bridged support for wireless networks. It used
to be the you had to use NAT when running your Virtual Machines under
Linux using a wireless card. This feature had been available for
windows hosts for awhile.

December 2, 2005

Using XSLT Stylesheets with Arbortext E3 for HTML Output

Filed under: Software,XSLT — cangione @ 5:30 pm

"convert" apparently expects to find an ATI processing instruction in
xsl stylesheets before it will execute HTML transformations. Otherwise
it only produces XML.

The PI should take the following form and be inserted as follows:

<?xml version="1.0"?>
<?APT StylesheetID Title="FOOBAR" CompositionTypes="htmlfile"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Powered by WordPress