[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [xml-dev] XSLT Stylesheet test for special charact
At 2009-01-22 14:08 +0100, nico wrote:
Hello, Not when that element has embedded content. If you had: <ns:strong>this has <ns:em>emphasized text</ns:em> in it</ns:strong> Then in XSLT <xsl:variable name="value" select="ns:strong/text()"/> ... is a node set variable with two text nodes "this has " and " in it". Whereas <xsl:variable name="value" select="ns:strong"/> ... is a node set variable with one element node, whose text value is "this has emphasized text in it". In all of my production work I have very very rarely ever had to directly address text nodes. Perhaps in a match pattern for nuanced matching, but I can't think of where I've used it in a value-of. I tell my students "if you think you need to address a text node directly, think again because you may but you probably don't". Try that with a XSLT debugger, I've found with my customers and my students a danger in trying to interpret language behaviour from the perspective of a debugger: you only understand what you see based on the data sample you are working with. This doesn't explain the proper behaviour of language constructs. see what you have in that variable, and then you can try something like : False. The XPath expression "text()" when the current node is an element returns only the text node immediate children of the element, not the concatenated string value of the element. Use a debugger ! (Oxygen has a great one) A debugger is great, but only when you know what you are doing in the language ... it can be very misleading to use a debugger as a learning tool. I hope these comments are considered constructive ... I didn't want a reader of the archive to be mislead. . . . . . . . . . . Ken -- Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes: : Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|