By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 458,018 Members | 1,042 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,018 IT Pros & Developers. It's quick & easy.

# XSLT: branching node processing with respect to node type possible?

 P: n/a Dear Masters of XSLT Could I ask you for a clue on the following question? I'd like to use XSLT to transform an XML source file to LaTeX. In the following small example the Element contains (I think so) - a text node (node one) - an element node (node two) - a text node (node three) Example: Some words or lines of common text with LaTeX special characters like $, # and _ (underscore) appear before an element node. Attention! Take care for converting$ to \$, # to \# and _ to \_ before running latex. I'd like to process the nodes in the element content one after the other with respect to their node type. For text nodes it's sufficient just to change all occuring special characters, while the element node should get e.g. a \textbf{} or \emph{} before its content will be inserted (self-evidently after first changing the special characters). In terms of pseudo-XSLT: Unfortunately, this works only, when the element node is cut out from the above example. I spend about five days but gained no success. I pressume that my point of view is unfavo- rable: Given the childs of a element node. Take one after the other and detect the node type. "Node one is an element node, node two is a processing instruction, ...". I'm working with XSLT for several months now, but still haven't understood how to think/to look at a problem to find an approp- riate solution in XSLT. I'd gratefully appreciate any hint on the topic at hand as well as on "Thinking in XSLT". Thank you very much, Ralf Jul 20 '05 #1 Share this Question 2 Replies  P: n/a Hi Ralf, The best suggestion would be to avoid using in this type of processing - your might get extremely large, complicated and unwieldy. When processing nodes where the order is important but yet different actions/processing is to take place for each different node then and matching templates is usually the best route, e.g. a very crude example of processing your XML... \emph{ } \textbf{ } Hope this helps Marrow http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger) http://www.topxml.com/Xselerator "Ralf Wahner" wrote in message news:6a**************************@posting.google.c om... Dear Masters of XSLT Could I ask you for a clue on the following question? I'd like to use XSLT to transform an XML source file to LaTeX. In the following small example the Element contains (I think so) - a text node (node one) - an element node (node two) - a text node (node three) Example: Some words or lines of common text with LaTeX special characters like$, # and _ (underscore) appear before an element node. Attention! Take care for converting $to \$, # to \# and _ to \_ before running latex. I'd like to process the nodes in the element content one after the other with respect to their node type. For text nodes it's sufficient just to change all occuring special characters, while the element node should get e.g. a \textbf{} or \emph{} before its content will be inserted (self-evidently after first changing the special characters). In terms of pseudo-XSLT: Unfortunately, this works only, when the element node is cut out from the above example. I spend about five days but gained no success. I pressume that my point of view is unfavo- rable: Given the childs of a element node. Take one after the other and detect the node type. "Node one is an element node, node two is a processing instruction, ...". I'm working with XSLT for several months now, but still haven't understood how to think/to look at a problem to find an approp- riate solution in XSLT. I'd gratefully appreciate any hint on the topic at hand as well as on "Thinking in XSLT". Thank you very much, Ralf Jul 20 '05 #2

 P: n/a Dear Mr. Marrow Thank you very much for your reply. You showed me precisely what I was looking for. I didn't hit on writing an own template for text as you proposed: \textbf{ } My only approach in handling pure text content sofar was . I take the way you treat beginners like me as a good example. The more I learn the earlier I can contribute to news group discussions. Best regards, Ralf Jul 20 '05 #3

### This discussion thread is closed

Replies have been disabled for this discussion.