Subject: Re: [xsl] xsl grabbing specific data From: tom jones <h8_bsod@xxxxxxxxx> Date: Thu, 9 Sep 2004 07:38:31 -0700 (PDT) |
Anton, Thank you so much, looks like I have a lot to learn. >From your example I have a much better understanding of where I need to go. Only question I have now is say that an xml has two identical trees, Like <xml> <name value="dan"> <name value="dan"> </xml> Is there a way to stop the duplicaes during the transform. I ran your transform and low and behold boot.ini came to my results like above. Once again thanks for the help. Dan Sherman --- cking <cking@xxxxxxxxxx> wrote: > Hi Dan, > > Maybe you can create an additional xml-file, say > 'files.xml': > > <files> > <file>boot.ini</file> > <file>compmgmt.msc</file> > ... > </files> > > And then use > > <xsl:variable name="files" > select="document('files.xml')/files/file"/> and > <xsl:if test="$files[contains(file-acl/@name, > .)]"> > > to extract only the files you want... something like > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="xml" version="1.0" > encoding="utf-8" indent="yes"/> > > <xsl:variable name="files" > select="document('files.xml')/files/file"/> > > <xsl:template match="/"> > <list> > <xsl:apply-templates > select="//file-acl-list/file-acl"/> > <!-- NOTE: if possible, pass absolute path rather > than "//" --> > </list> > </xsl:template> > > <xsl:template match="file-acl"> > <xsl:if test="$files[contains(current()/@name, > .)]"> > <xsl:variable name="filename"> > <xsl:call-template name="filename-from-path"> > <xsl:with-param name="name" select="@name"/> > </xsl:call-template> > </xsl:variable> > <file name="{$filename}"> > <xsl:apply-templates select="ace"/> > </file> > </xsl:if> > </xsl:template> > > <xsl:template match="ace"> > <xsl:if test="@is-grant = 'true'"> > <!-- or do whatever else to handle this --> > <ace trustee="{@trustee}"/> > </xsl:if> > </xsl:template> > > <xsl:template name="filename-from-path"> > <xsl:param name="name"/> > <xsl:choose> > <xsl:when test="contains($name, '\')"> > <xsl:call-template name="filename-from-path"> > <xsl:with-param name="name" > select="substring-after($name, '\')"/> > </xsl:call-template> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="$name"/> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > </xsl:stylesheet> > > HTH, > Anton Triest > > __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl grabbing specific dat, cking | Thread | Re: [xsl] xsl grabbing specific dat, cking |
RE: [xsl] Xalan pronunciation, Andrew Welch | Date | RE: [xsl] Xalan pronunciation, Peter Flynn |
Month |