[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: another xpath question
> If I have the following simplified XML snippet: > > === > <xref xrefid="AA140110301W10AA" xidtype="TEXT"/> > <title> > Renew LP Piston Seal (Fig 5.5.1 > <xref xrefid="F5.5.1" xidtype="FIGURE">) </xref> > </title> If I modify the title template to: > > <xsl:template match="title"> > <xsl:value-of select="."/> > <xsl:apply-templates/> > </xsl:template> > > I get the output: > > (xref) > Renew LP Piston Seal (Fig 5.5.1) > (xref) The <xsl:value-of> outputs the string value of the <title> element, which is the concatenation of all the text it contains, that is "Renew LP Piston Seal (Fig 5.5.1)". The <xsl:apply-templates/> then processes all the child nodes of the <title>: a text node, an <xref> element, and another text node. I guess you have a template rule that ensures text nodes produce no output, so the only output is from processing the <xref> node, which is "(xref)". > > Whereas the output I want is > > (xref) > Renew LP Piston Seal (Fig 5.5.1(xref)) //the (xref) will be > a graphic... Remove the call on <xsl:value-of>, and use the default template rule for text nodes, which outputs the text content of the node. > And, why will > it not match the inner <xref> without calling > apply-templates? I thought it > would look for a template match whenever it encountered a tag. It won't encounter a "tag" (you should say "element" or "node", you'll understand the specs more easily if you learn the correct jargon) unless you tell it to look for that element or node. The call on xsl:apply-templates is asking it do to so. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|