- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
barcodewriter zxing c# Summary You can replace an <xsl:for-each> element with a template holding its contents and an in Font
Summary You can replace an <xsl:for-each> element with a template holding its contents and an Making PDF417 In None Using Barcode maker for Font Control to generate, create PDF 417 image in Font applications. www.OnBarcode.comQR Code Printer In None Using Barcode encoder for Font Control to generate, create Denso QR Bar Code image in Font applications. www.OnBarcode.com<xsl:apply-templates> element selecting the nodes you want to process.
Print GTIN - 12 In None Using Barcode generation for Font Control to generate, create UPC-A Supplement 2 image in Font applications. www.OnBarcode.comDraw UCC - 12 In None Using Barcode drawer for Font Control to generate, create EAN / UCC - 14 image in Font applications. www.OnBarcode.comReplacing <xsl:for-each> with Templates
European Article Number 13 Encoder In None Using Barcode creator for Font Control to generate, create EAN / UCC - 13 image in Font applications. www.OnBarcode.comDrawing Barcode In None Using Barcode generator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comWe ve still used <xsl:for-each> in a couple of other places within TVGuide4.xsl, so let s convert those instances in the same way as we ve done with the one that iterated over <Channel> elements. The next <xsl:for-each> is where we iterate over the <Program> elements, which is within the template that matches <Channel> elements. We can convert it by first replacing the <xsl:for-each> with an <xsl:apply-templates> element that has the same value for its select attribute: <xsl:template match="Channel"> <h2 class="channel"><xsl:value-of select="Name" /></h2> <xsl:apply-templates select="Program" /> </xsl:template> and then creating a template that matches <Program> elements. The new template has the same contents as the old <xsl:for-each> did: <xsl:template match="Program"> <div> <p> <span class="date"><xsl:value-of select="Start" /></span><br /> <span class="title"><xsl:value-of select="Series" /></span><br /> <xsl:value-of select="Description" /> <span onclick="toggle({Series}Cast);">[Cast]</span> </p> <div id="{Series}Cast" style="display: none;"> <ul class="castlist"> <xsl:for-each select="CastList/CastMember"> Paint Barcode In None Using Barcode creator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comPaint ISSN - 10 In None Using Barcode maker for Font Control to generate, create International Standard Serial Number image in Font applications. www.OnBarcode.comCHAPTER 3 TEMPLATES
PDF417 Creator In None Using Barcode creator for Excel Control to generate, create PDF417 image in Office Excel applications. www.OnBarcode.comPDF417 Maker In Java Using Barcode creator for Java Control to generate, create PDF 417 image in Java applications. www.OnBarcode.com<xsl:value-of select="Character" /> </span> <span class="actor"> <xsl:value-of select="Actor" /> </span> </li> </xsl:for-each> </ul> </div> </div> </xsl:template> This template also contains an <xsl:for-each>, one that iterates over the <CastMember> element children of <CastList> elements. Again, we can replace this <xsl:for-each> with an <xsl:apply-templates>: <xsl:template match="Program"> <div> <p> <span class="date"><xsl:value-of select="Start" /></span><br /> <span class="title"><xsl:value-of select="Series" /></span><br /> <xsl:value-of select="Description" /> <span onclick="toggle({Series}Cast);">[Cast]</span> </p> <div id="{Series}Cast" style="display: none;"> <ul class="castlist"> <xsl:apply-templates select="CastList/CastMember" /> </ul> </div> </div> </xsl:template> and create a separate template that deals with giving output for <CastMember> elements: <xsl:template match="CastMember"> <li> <span class="character"><xsl:value-of select="Character" /></span> <span class="actor"><xsl:value-of select="Actor" /></span> </li> </xsl:template> We now have four templates in TVGuide5.xsl, matching The document node <Channel> elements <Program> elements <CastMember> elements If you run TVGuide5.xsl with TVGuide.xml, you should get exactly the same result as the original, simplified stylesheet. Splitting up the processing into separate templates hasn t changed the result of the transformation. UPC-A Supplement 2 Drawer In None Using Barcode generation for Online Control to generate, create UPCA image in Online applications. www.OnBarcode.comBarcode Drawer In VS .NET Using Barcode creation for Reporting Service Control to generate, create Barcode image in Reporting Service applications. www.OnBarcode.comCHAPTER 3 TEMPLATES
USS Code 39 Maker In Java Using Barcode generation for Eclipse BIRT Control to generate, create ANSI/AIM Code 39 image in BIRT reports applications. www.OnBarcode.comBarcode Recognizer In Visual C# Using Barcode scanner for VS .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comThe Built-in Templates
Quick Response Code Recognizer In None Using Barcode decoder for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comQR Code Reader In VB.NET Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comWe ve seen that when you apply templates to a node, the XSLT processor tries to find the template that matches that node. But what happens when there isn t a template that matches a node For example, if we applied templates to the <Name> child of the <Channel> element, as follows, but didn t have a template to match the <Name> element: <xsl:template match="Channel"> <h2 class="channel"><xsl:apply-templates select="Name" /></h2> <xsl:apply-templates select="Program" /> </xsl:template> When the XSLT processor can t find a template to match the node that it s been told to process, it uses a built-in template. If you find that the result of your stylesheet includes text you didn t expect, chances are that it s due to the built-in templates. Just because there isn t a template for a particular node doesn t mean that the node s not processed. For elements, the built-in template is as follows: <xsl:template match="*"> <xsl:apply-templates /> </xsl:template> This template uses two bits of syntax that we haven t seen before: The match attribute of the template takes the value *. Templates with a match pattern of * match all elements. The <xsl:apply-templates> element doesn t have a select attribute. If you use <xsl:apply-templates> without a select attribute, the XSLT processor collects all the children of the current node (which is the node that the template matches) and applies templates to them. To see the effect of this, take another look at the part of the node tree containing the <Name> element, shown in Figure 3-6. Creating Barcode In .NET Using Barcode generation for ASP.NET Control to generate, create Barcode image in ASP.NET applications. www.OnBarcode.comCreating 2D Barcode In .NET Using Barcode printer for .NET framework Control to generate, create 2D Barcode image in .NET applications. www.OnBarcode.comelement: Name text: BBC1
Reading UPC-A Supplement 2 In Java Using Barcode decoder for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comGS1 DataBar Limited Printer In VS .NET Using Barcode maker for .NET Control to generate, create GS1 DataBar Expanded image in Visual Studio .NET applications. www.OnBarcode.comFigure 3-6. The <Name> element and its text node child
The <Name> element has only one child node, a text node with the value BBC1. When you tell the XSLT processor to apply templates to the <Name> element, it will use the built-in template for elements, and hence apply templates to that text node. Now, again, we don t have a template that matches text nodes in our stylesheet, so the processor uses a built-in template. The built-in template for text nodes is <xsl:template match="text()"> <xsl:value-of select="." />
|
|