Archive for December, 2005

Strange things when you forget the namespace!

Wednesday, December 21st, 2005

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.

Toggle colors on html span element using Javascript

Tuesday, December 20th, 2005

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>

VMware 5.5 Worth the Upgrade for Linux Hosts

Sunday, December 4th, 2005

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.

Using XSLT Stylesheets with Arbortext E3 for HTML Output

Friday, December 2nd, 2005

“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">