id() function : id « XSLT stylesheet « XML

Home
XML
1.CSS Style
2.SVG
3.XML Schema
4.XQuery
5.XSLT stylesheet
XML » XSLT stylesheet » id 
id() function



File: Data.xml

<?xml version="1.0" encoding="UTf-8" ?>
<emailList>
  <person>
    <name>name 1</name>
    <email>g@gmail.com</email>
  </person>
  <person>
    <name>name 2</name>
    <email>n@hotmail.com</email>
  </person>
</emailList>
File: Transform.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="emailList/person">
    <xsl:if test="id('p001 p002')">
      <div id="{@id}">
        <div>
          <xsl:value-of select="name" />
        </div>
        <div>
          <xsl:value-of select="email" />
        </div>
      </div>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>

 
Related examples in the same category
1.ID: xsl:value-of select="id(.)"
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.