Home Forums DITA and XMetaL Discussion Custom CSS and PI’s: little big problem Reply To: Custom CSS and PI’s: little big problem

barbwire

Reply to: Custom CSS and PI’s: little big problem

Well I tried and it indeed worked!

Big thanks to you Derek! I owe you a beer or something! 🙂

I did not use CSS at all. I did the customization to the *.mcr file. Tested with in several test cases and it worked.

[code]var pathpi = ActiveDocument.getNodesByXPath(“//topic/processing-instruction('my-pi')”);
  var pathtitle = ActiveDocument.getNodesByXPath(“//topic/title”);
  var rng = ActiveDocument.Range;
  var pathattr = ActiveDocument.getNodesByXPath(“//topic/@something”);
  if(pathpi.length > 0){
    var docpathpi = pathpi.item(0);
  var docPath = docpathpi.nodeValue;    
  if(docPath == “true”){
rng.SelectNodeContents(pathtitle(0));
rng.ContainerStyle=”background-color:transparent; color:black;”;
  }
  else if(docPath == “false”){
if(pathattr.length > 0){
var attrvalue = pathattr.item(0).nodeValue;
if(attrvalue == “true”){
rng.SelectNodeContents(pathtitle(0));
rng.ContainerStyle=”background-color:red; color:white;”;
}
}
  }
  }
  else if(pathtitle.length > 0){
if(pathattr.length > 0){
var attrvalue = pathattr.item(0).nodeValue;
if(attrvalue == “true”){
rng.SelectNodeContents(pathtitle(0));
rng.ContainerStyle=”background-color:red; color:white;”;
}
}
  }[/code]

Reply

Products
Downloads
Support