use variable in xslt

Variables we can define global variable at the beginning: TO use the variable just use: $ not AND concat use not() in the xls:if for negative: <xsl:if test=”not(./dataValueGrid[@name=reviewHistoryList])”>….</xls:if> use concat() for string concat, use “,” to seperate: <xsl:value-of select=”concat(‘/Application/DirectFormAccess.jsp?requestInstance=’, $reviewInstanceIdVar)” /> Advertisements

xslt apply templates

When you use <xsl:apply-templates/>, it is really short for <xsl:apply-templates select=”node()”/> and is being invoked inside of a template match on /, which is the root node of the document and an abstract concept for the top of the file. It’s children include the document element (i.e. <Page>), as well as any top-level comments or processing instructions that may be…

XPath Basic Syntax

XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps. The XML Example Document We will use the following XML document in the examples below. <?xml version=”1.0″ encoding=”ISO-8859-1″?> <bookstore> <book> <title lang=”eng”>Harry Potter</title> <price>29.99</price> </book> <book> <title lang=”eng”>Learning XML</title> <price>39.95</price> </book> </bookstore>…

add CDATA to xml DOM tree

A CDATA section indicates a block that shouldn’t be parsed. To build a CDATA section just wrap the string with a CDATA object. If append TextNode directly, it will not appear as CDATA but just plain text.

xml parse line break, line feed lost

\n or line break or line feed in a string would be stripped by xml parser and replaced by space. According to XML specification, any white space will be normalized into #xA; In order to preserve the line feed, we can just replace all the \n with which is the legal line feed in…

Notepad++ format xml file (indent)

TextFX To Indent a XML file in notepad++, TextFX > TextFX HTML Tidy > Tidy Reindent XML If the TextFX menu does not exist, you need to download & install the plugin. Plugins->Plugin Manager->Show Plugin Manager and then check the plugin TextFX Characters. Click ‘install,’ restart Notepad++. libTidy.dll might not be included in the new version of NPP. Solution…