Wildcard formatting in XML & XSLT

layereurA

New Member
Here's the XML file:\[code\]<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/10967522/2.xsl" ?><root> <shop> <person> <employee> <name> Alexis </name> <role> Manager </role> <task> Sales </task> </employee> <employee> <name> Employee2 </name> </employee> </person> <employee> <name> Blake2 </name> </employee> </shop></root>\[/code\]Here's the XSLT file:\[code\]<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="root"> <html><head></head> <body>Start of root in XSLT <p/> <xsl:apply-templates /> <p/>End of root in XSLT</body> </html> </xsl:template> <xsl:template match="shop">"Step 1 start"<xsl:apply-templates select="*/*"/>"Step 1 done" <p/></xsl:template> <xsl:template match="employee"> <b> <xsl:apply-templates select="name"/> </b> (Task: <xsl:apply-templates select="task"/>) <br></br> </xsl:template> </xsl:stylesheet>\[/code\]The output is:\[quote\] Start of root in XSLT "Step 1 start" Alexis (Task: Sales ) Employee2 (Task: ) Blake2 "Step 1 done" End of root in XSLT\[/quote\]My question is, why isn't Blake2 also in bold? It's under the \[code\]<employee>\[/code\] element.......and what's more interesting is if you change this part:\[code\]apply-templates select="*/*\[/code\] (which is under the "shop" element in the XSLT file)to this:\[code\]*apply-templates select="*"\[/code\]i.e just removing the 2nd wildcard, then Blake2 will have the format applied to it, which will make it bold.
 
Back
Top