Home > Articles > Web Services > XML

This chapter is from the book

Using the XPath Axes

There are 13 axes to master, and we'll take a look at them here, complete with examples. To understand how something like XPath works, there's no better way than seeing it at work as much as possible.

We'll take a look at various examples using XPath Visualiser, and we'll also take a look at some examples using the XPath axes with XSLT. You don't really have to understand the XSLT at this point—you can just pick out the XPath expression inside the example. But XSLT is important when working with XPath, as we're going to see in Chapter 5, and here it will help us out when XPath Visualiser can't (as with the namespace axis, which XPath Visualiser doesn't display visually). We're already familiar with the child and attribute axes, so we won't introduce them here, but we will introduce all the other axes now, beginning with the ancestor axis.

Using the ancestor Axis

The ancestor axis contains all the ancestors of the context node, including its parents, grandparents, great-grandparents, and so on. This axis always contains the root node (unless the context node is the root node).

Here's an example using XPath Visualiser. In this case, we'll use the location path //planet/day to select the <day> elements in our planetary data example, ch03_01.xml. Then we'll work backward with the ancestor axis to find the <planet> ancestor of each <day> element like this: //planet/day/ancestor::planet. You can see the results in Figure 3.7 (note that we're only searching for <planet> ancestors with this location path, so only <planet> ancestors are selected).

Figure 3.7Figure 3.7 Using the ancestor axis.




Here's an example doing the same thing using XSLT. As discussed in Chapter 1, in XSLT you create a template with an <xsl:template> element to match nodes. In this case, we want to match <day> elements:

<xsl:template match="day">
    .
    .
    .
</xsl:template>

Now we'll use an <xsl:for-each> element to loop over all ancestors of the <day> element, using the XPath ancestor axis:

<xsl:template match="day">
    <xsl:for-each select="ancestor::*">
             .
             .
             .
    </xsl:for-each>
</xsl:template>

To display the name of the ancestor element, we can use the XSLT <xsl:value-of> element. We can extract the name of the current planet with the XPath expression ./name, where . selects the context node. Here's what that looks like in XSLT:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="day">
    <xsl:for-each select="ancestor::*">
        <xsl:value-of select="./name"/>
        </xsl:for-each>
    </xsl:template>

<xsl:template match="planet">
    <xsl:apply-templates select="day"/>
</xsl:template>

</xsl:stylesheet>

And here's the result when you use this stylesheet on ch03_01.xml—as you can see, we've been able to pick out the names of the ancestors of the <day> elements in our document:

<?xml version="1.0" encoding="utf-8"?>
  Mercury
  Venus
  Earth

Using the ancestor-or-self Axis

The ancestor-or-self axis contains all the ancestors of the context node, and the context node itself. That means, among other things, that this axis always contains the root node.

Here's an example using XPath Visualiser. In this case, we'll use this axis to select all ancestors of <day> elements, as well as the <day> element itself this way: /planet/day/ancestor-or-self::*. You can see the results in Figure 3.8.

Figure 3.2Figure 3.8 Using the ancestor-or-self axis.




Here's an example using XSLT and the ancestor-or-self axis. In this case, we're going to add author attributes set to "Thaddeus" throughout our document like this:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xml" href="planets.xsl"?>
<planets author="Thaddeus" >
            
    <planet author="Thaddeus" language="English">
         <name>Mercury</name>
         <mass units="(Earth = 1)">.0553</mass>
         <day author="Thaddeus" units="days">58.65</day>
         <radius units="miles">1516</radius>
         <density units="(Earth = 1)">.983</density>
         <distance units="million miles">43.4</distance><!--At perihelion-->
    </planet>

    <planet author="Thaddeus" language="English">
        <name>Venus</name>
        <mass units="(Earth = 1)">.815</mass>
        <day units="days">116.75</day>
        <radius units="miles">3716</radius>
        <density units="(Earth = 1)">.943</density>
        <distance units="million miles">66.8</distance><!--At perihelion-->
    </planet>

    <planet language="English">
       <name>Earth</name>
       <mass units="(Earth = 1)">1</mass>
       <day units="days">1</day>
       <radius units="miles">2107</radius>
       <density units="(Earth = 1)">1</density>
       <distance units="million miles">128.4</distance><!--At perihelion-->
    </planet>

</planets>

Now say that you want to list by name all ancestors of <day> elements that have an author attribute—as well as the current <day> element if it has an author attribute. To do that, you can use the XPath location path ancestor-or-self::*[@author], which matches all nodes and ancestors that have an author attribute. Here's what it looks like in XSLT:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="day">
     <xsl:for-each select="ancestor-or-self::*[@author]">
         <xsl:value-of select="local-name(.)"/>
         <xsl:text> </xsl:text>
      </xsl:for-each>
</xsl:template>

<xsl:template match="planet">
  <xsl:apply-templates select="day"/>
</xsl:template>

</xsl:stylesheet>

Here's the result, showing the matching ancestors of all three <day> elements that have author attributes, including the <day> element itself, which has an author attribute:

<?xml version="1.0" encoding="UTF-8"?>

   planets planet day
   planets planet
   planets

Using the descendant Axis

The descendant axis contains all the descendants of the context node. Note that this does not include any attributes or namespace nodes.

Here's an example using XPath Visualiser. In this case, we'll select all descendants of <planet> elements with the location path //planet/descendant::*, as you see in Figure 3.9.

Figure 3.9Figure 3.9 Using the descendant axis.




Here's an example using XSLT. In this case, we'll check a document to see if it includes a <planet> element for Mercury, and if so, we'll include this element in the result: <info>Sorry, Mercury cannot be found at this time.</info>. To match Mercury's <planet> element, all you have to do is to check whether any text node descendant of a <planet> element holds the string "Mercury" this way:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="planet[descendant::text()='Mercury']">
   <info>Sorry, Mercury cannot be found at this time.</info>
</xsl:template>
                  
<xsl:template match="*">
   <xsl:apply-templates select="*"/>
</xsl:template>

</xsl:stylesheet>

That's all it takes. Here's the result, showing the <info> element:

<?xml version="1.0" encoding="utf-8"?>
<info>Sorry, Mercury cannot be found.</info>

Using the descendant-or-self Axis

The descendant-or-self axis contains all the descendants of the context node, and the context node itself. Note, however, that it does not contain any attributes or namespace nodes.

You can see an example in Figure 3.10, where we're selecting all <planet> elements and their descendants with the XPath location path //planet/descendant-or-self::*.

Here's an example doing the same thing using XSLT. In this case, we'll use an XSLT template to match all <planet> elements and then loop over all nodes in the node-set returned by using the descendant-or-self axis, displaying each node's name:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

 <xsl:template match="planet">
    <xsl:for-each select="descendant-or-self::*">
         <xsl:value-of select="local-name()"/>
         <xsl:text> </xsl:text>
    </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>
Figure 3.10Figure 3.10 Using the descendant-or-self axis.

That's all it takes. Here's the result, where we've been able to list the name of all the descendants of <planet> elements, as well as the <planet> elements themselves, using the descendant-or-self axis:

<?xml version="1.0" encoding="UTF-8"?>
  planet name mass day radius density distance
  planet name mass day radius density distance
  planet name mass day radius density distance

Using the following Axis

The following axis contains all nodes that come after the context node in document order, excluding any of the context node's descendants—and also excluding attribute nodes and namespace nodes.

You can see an example in the XPath Visualiser in Figure 3.11, where we're using this axis to select the following elements after the <mass> element in the first <planet> element, using the XPath location path /planets/planet[1]/mass/following::*.

Figure 3.11Figure 3.11 Using the following axis to extract data.

Here's an example using XSLT to do the same thing. In this case, we're matching the first <planet> element in an XSLT template and displaying the names of the following elements:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="planet[1]">
   <xsl:for-each select="mass/following::*">
        <xsl:value-of select="local-name()"/>
        <xsl:text> </xsl:text>
   </xsl:for-each>
</xsl:template>

 <xsl:template match="*">
   <xsl:apply-templates select="*"/>
 </xsl:template>

</xsl:stylesheet>

Here's what the result looks like. Note that we've been able to get all the elements following the <mass> element in the first <planet> element, and then all the following elements in the rest of the document:

<?xml version="1.0" encoding="UTF-8"?>
day radius density distance 
planet name mass day radius density distance 
planet name mass day radius density distance

Using the following-sibling Axis

The following-sibling axis contains all the following siblings of the context node. You can see an example in the XPath Visualiser in Figure 3.12, where we're using the XPath location path /planets/planet[1]/mass/following-sibling::* to select all following sibling nodes of the <mass> element in the first <planet> element.

Figure 3.12Figure 3.12 Using the following-sibling axis.

Here's how this example works in XSLT; in this case, we're also matching the first <planet> element's <mass> element and then getting its following sibling elements:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="planet[1]">
    <xsl:for-each select="mass/following-sibling::*">
         <xsl:value-of select="local-name()"/>
          <xsl:text> </xsl:text>
     </xsl:for-each>
</xsl:template>

 <xsl:template match="*">
   <xsl:apply-templates select="*"/>
 </xsl:template>

</xsl:stylesheet>

Here's the result—as you can see, we've caught all the siblings following the <mass> element in the first <planet> element:

<?xml version="1.0" encoding="UTF-8"?>
day radius density distance

Using the namespace Axis

The namespace axis contains the namespace nodes of the context node—note that the axis will be empty unless the context node is an element. An element will have a namespace node for

  • Every attribute of the element whose name starts with "xmlns:".

  • Every attribute of an ancestor element whose name starts "xmlns:" (unless, of course, the element itself or a nearer ancestor redeclares the namespace).

  • An xmlns attribute, if the element, or some ancestor, has an xmlns attribute.

XPath Visualiser doesn't handle this axis visually, so we'll rely on XSLT here. Here, we'll add an XML namespace declaration to the <planets> element, using the namespace "http://www.XPathCorp.com" like this:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xml" href="planets.xsl"?>
<planets xmlns="http://www.XPathCorp.com">
                      
  <planet>
    <name>Mercury</name>
    <mass units="(Earth = 1)">.0553</mass>
    <day units="days">58.65</day>
    <radius units="miles">1516</radius>
    <density units="(Earth = 1)">.983</density>
    <distance units="million miles">43.4</distance><!--At perihelion-->
  </planet>
    .
    .
    .

In XSLT, we can check the namespaces used in the <planets> element like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="planets">
    <xsl:value-of select="namespace::*"/>
</xsl:template>
                      
</xsl:stylesheet>

And here's the result, showing that we can indeed pick out the namespace:

<?xml version="1.0" encoding="UTF-8"?>
http://www.XPathCorp.com

Using the parent Axis

The parent axis contains the parent (and only the parent) of the context node, if there is one.

You can see an example in XPath Visualiser in Figure 3.13. Here, we're picking out the parent elements of all <day> elements with the XPath location path //day/parent::*.

Figure 3.13Figure 3.13 Using the parent axis to extract data.

And here's the same example in XPath. In this case, we'll match all <day> elements and get the names of their parent elements. Here's what it looks like:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

<xsl:template match="//day">
     <xsl:for-each select="parent::*">
         <xsl:value-of select="local-name()"/>
         <xsl:text> </xsl:text>
     </xsl:for-each>
</xsl:template>
                        
<xsl:template match="*">
  <xsl:apply-templates select="*"/>
</xsl:template>

</xsl:stylesheet>

And here's the result:

<?xml version="1.0" encoding="UTF-8"?>
planet planet planet

Using the Abbreviation ..

Remember that you can also use the abbreviation .. to stand for the parent of the context node.

Using the preceding Axis

The preceding axis contains all nodes that are before the context node in document order, excluding any ancestors of the context node, and also excluding attribute nodes and namespace nodes.

Here's an example using XPath Visualiser. In this case, we'll select all elements preceding the <density> element in the first planet element with the XPath location path //planet[1]/density/preceding::*, as you can see in Figure 3.14.

Let's give this axis a try in XSLT. In this case, say that we want to set the content of the <distance> element to the text "This planet is farther than Mercury from the sun." if the current planet is indeed farther from the sun than Mercury. One way to do that is to see if Mercury comes before the current planet in document order, using the preceding axis:

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:output method="xml"/> <xsl:template match="distance[preceding::*/name='Mercury']">
   <distance>This planet is farther than Mercury from the sun.</distance>
 </xsl:template>
                             
 <xsl:template match="@*|node()">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
 </xsl:template>

</xsl:stylesheet>
Figure 3.14Figure 3.14 Using the preceding axis to select elements.

If the current planet does come after Mercury, this example inserts the message in its <distance> element, as you see in this result:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xml" href="planets.xsl"?>
<planets>

  <planet>
    <name>Mercury</name>
    <mass units="(Earth = 1)">.0553</mass>
    <day units="days">58.65</day>
    <radius units="miles">1516</radius>
    <density units="(Earth = 1)">.983</density>
    <distance units="million miles">43.4</distance>
    <!--At perihelion-->
  </planet>

  <planet>
    <name>Venus</name>
    <mass units="(Earth = 1)">.815</mass>
    <day units="days">116.75</day>
    <radius units="miles">3716</radius>
    <density units="(Earth = 1)">.943</density>
    <distance>This planet is farther than Mercury from the sun.</distance>
    <!--At perihelion-->
  </planet>

  <planet>
    <name>Earth</name>
    <mass units="(Earth = 1)">1</mass>
    <day units="days">1</day>
    <radius units="miles">2107</radius>
    <density units="(Earth = 1)">1</density>
    <distance>This planet is farther than Mercury from the sun.</distance>
    <!--At perihelion-->
  </planet>

</planets>

Using the preceding-sibling Axis

The preceding-sibling axis contains all the preceding siblings of the context node. Note that if the context node is an attribute node or namespace node, the preceding-sibling axis won't hold anything.

You can see an example in the XPath Visualiser in Figure 3.15, where we're using the XPath location path //planet[2]/preceding-sibling::* to select all preceding siblings of the second <planet> element. Note that just the first <planet> element is selected. On the other hand, if we had used //planet[2]/preceding::*, not only would the first <planet> element be selected, but all that element's child elements would be selected as well.

Here's a more advanced example using XSLT. In this case, we'll replace the <distance> element in Mercury's <planet> element with <distance>This planet is the closest to the sun.</distance>. If we're matching <distance> elements, how can we make sure that we've got Mercury's <distance> element? We can check the current <distance> element's preceding siblings and look for the text "Mercury". Here's what it looks like in XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>

 <xsl:template match="distance[preceding-sibling::*='Mercury']">
     <distance>This planet is the closest to the sun.</distance>
 </xsl:template>
                              
 <xsl:template match="@*|node()">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>

</xsl:stylesheet>

Figure 3.15Figure 3.15 Using the preceding-sibling axis to extract data.

And here's the result:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xml" href="planets.xsl"?>
<planets>

  <planet language="English">
    <name>Mercury</name>
    <mass units="(Earth = 1)">.0553</mass>
    <day units="days">58.65</day>
    <radius units="miles">1516</radius>
    <density units="(Earth = 1)">.983</density>
    <distance>This planet is the closest to the sun.</distance>
    <!--At perihelion-->
  </planet>

  <planet language="English">
    <name>Venus</name>
    <mass units="(Earth = 1)">.815</mass>
    <day units="days">116.75</day>
    <radius units="miles">3716</radius>
    <density units="(Earth = 1)">.943</density>
    <distance units="million miles">66.8</distance><!--At perihelion-->
  </planet>

  <planet language="English">
    <name>Earth</name>
    <mass units="(Earth = 1)">1</mass>
    <day units="days">1</day>
    <radius units="miles">2107</radius>
    <density units="(Earth = 1)">1</density>
    <distance units="million miles">128.4</distance><!--At perihelion-->
  </planet>

</planets>

Using the self Axis

The self axis contains just the context node, and you can abbreviate "self::node()" as ".". This is a useful axis to know about, because as you know, if you omit the axis, the default is child::, but sometimes you want to refer to the current node instead. For example, [self::planet] is true only if the context node is a <planet> element.

You can see an example using this axis in XPath Visualiser in Figure 3.16, where we're using the XPath location path //*[self::radius] to select <radius> elements in ch03_01.xml (this location path is equivalent to //radius).

Here's an example using XSLT. In this case, we'll use one template to match both <name> and <day> elements in the same template. We can do that by matching name | day in a template like this (more on how this works in the next section):

  <xsl:template match="name | day">
    .
    .
    .
  </xsl:template>

At this point, we've matched both <name> and <day> elements—but suppose that in the body of the template we actually want to treat these elements differently. To do that, we have to check if we're dealing with a <name> element or a <day> element, which we can do with the XSLT element <xsl:if>, where you assign the condition to test to this element's test attribute. Here's what it looks like in XSLT:

  <xsl:template match="name | day">

        <xsl:if test="self::name">
             <xsl:value-of select="."/>
        </xsl:if>

        <xsl:if test="self::day">
             <xsl:value-of select="."/>
             <xsl:text> </xsl:text>
             <xsl:value-of select="@units"/>
        </xsl:if>
                              
  </xsl:template>
    .
    .
    .
Figure 3.16Figure 3.16 Using the self axis to select <radius> elements.

So now we've taken a look at all 13 axes, from the ancestor axis to the self axis. Note that you can combine location paths with the | operator—we'll take a closer look at that now.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020