XSLT Tip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul,

+      <xsl:for-each select="/rpm-info/copyright">
+	<xsl:element name="copyright">
+	  <xsl:for-each select="/rpm-info/copyright/year"><xsl:element name="year">
+	      <xsl:value-of select="node()"/>
+	    </xsl:element></xsl:for-each>
+	  <xsl:for-each select="/rpm-info/copyright/holder">
+	    <xsl:element name="holder">
+	      <xsl:value-of select="node()"/>
+	    </xsl:element>
+	  </xsl:for-each>
+	</xsl:element>
+      </xsl:for-each>

This is a bit verbose.  Embedding so much of each element's path here
can be detrimental to maintainability. The <xsl:for-each> cycles
through the available /rpm-info/copyright/ elements, setting the
symbol "." or node() to the element currently getting the "focus", so
you could write this as:

<xsl:for-each select="/rpm-info/copyright">
  <xsl:element name="copyright">
    <xsl:for-each select="year">
      <xsl:value-of select="."/>
    </xsl:for-each>
  </xsl:element>
</xsl:for-each>

HTH.

Attachment: pgpH0Gn0bEIof.pgp
Description: PGP signature

-- 

fedora-docs-list@xxxxxxxxxx
To unsubscribe: 
https://www.redhat.com/mailman/listinfo/fedora-docs-list

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Red Hat 9]     [Yosemite News]     [KDE Users]

  Powered by Linux