[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Find invalid IDREFs

Subject: Find invalid IDREFs
From: charlieo0@xxxxxxxxxxx
Date: Thu, 17 May 2012 20:42:03 +0000 (UTC)
 Find invalid IDREFs
I am completely stuck figuring this out. I have list of IDREFs captured from an error report. I created a well-formed XML instance from the list of values. This is list of IDREFs that have no corresponding ID. I need to find these IDREF atrributes in a very large collection of files and generate a report that tells writers what files the errors are located.

The validation report was generated from a concatenated, very large complete manual. I can locate the errors in that file, but that's not how the manual is worked. I need to locate each error in the sub-files.

How do I walk through the list of IDREF elements, locate them in a collection of approx. 600 files and generate a report? Any help is appreciated.

XSLT 2.0

My list of IDREFs looks like this (abbreviated):


<?xml version="1.0" encoding="UTF-8"?>
<IDREFS>
<IDREF>NSN-</IDREF>
<IDREF>NSN-</IDREF>
<IDREF>m2025792355320</IDREF>
<IDREF>m22040592355332</IDREF>
<IDREF>m22040592355332</IDREF>
<IDREF>m22040592355332</IDREF>
<IDREF>m2034792355320</IDREF>
<IDREF>m2050492355320</IDREF>
</IDREFS>

My XSLT, which renders no results:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      exclude-result-prefixes="xs"
      version="2.0">
    
   <xsl:output method="text"  omit-xml-declaration="yes" indent="no" />
   <xsl:param name="collection" select="collection('file:/M:/?select=M2*.xml')"/>
   <xsl:variable name="IDREFS" select="document('file:/C:/IDREFS.xml')"/>
    <xsl:key name="VALUE" match="IDREFS" use="child::IDREF"/>
    
    <xsl:template match="/">
        <xsl:result-document method="text" href="file:/C:/bae/test.txt">
        <xsl:for-each select="$collection//@wpid | //@itemid">
            <xsl:variable name="ATTR" select="."/>
            <xsl:for-each select="$IDREFS">
                <xsl:value-of select="base-uri(.)"/><xsl:value-of select="key('VALUE',$ATTR)"/>
            </xsl:for-each>
            <xsl:text>&#x0A;</xsl:text>
        </xsl:for-each>
    </xsl:result-document>
    </xsl:template>

</xsl:stylesheet>



C Flanders

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.