Click here to Skip to main content
15,888,283 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionCompletly stuck.... With XML Sorting Pin
Axiom70m4-Oct-09 1:25
Axiom70m4-Oct-09 1:25 
AnswerRe: Completly stuck.... With XML Sorting Pin
Christian Graus4-Oct-09 11:23
protectorChristian Graus4-Oct-09 11:23 
QuestionHow do i auto generate Create, insert, update and delete command from Xml file Pin
femyJames28-Sep-09 2:38
femyJames28-Sep-09 2:38 
AnswerRe: How do i auto generate Create, insert, update and delete command from Xml file Pin
Richard MacCutchan28-Sep-09 3:49
mveRichard MacCutchan28-Sep-09 3:49 
AnswerRe: How do i auto generate Create, insert, update and delete command from Xml file Pin
Christian Graus3-Oct-09 11:57
protectorChristian Graus3-Oct-09 11:57 
QuestionXML Column in SQL Server 2005 Pin
Kartik Kumar28-Sep-09 0:00
Kartik Kumar28-Sep-09 0:00 
AnswerRe: XML Column in SQL Server 2005 [modified] Pin
Nisha Agrawal28-Sep-09 0:44
Nisha Agrawal28-Sep-09 0:44 
QuestionNamespace Parsing Problem Pin
sdsuzuki24-Sep-09 6:50
sdsuzuki24-Sep-09 6:50 
I’m new to XSL and struggling with this for awhile. Hope someone can take a look at my code and provide me with your feedback. The output looks close to what I want, but it’s not quite there yet. I’m looking for certain attributes (id=GUIDs) in ‘task’ element and copy the entire ‘task’ element if the attribute is matched with what I’m looking for. However the namespace cannot be copied correctly. Basically I don’t want the output to have the reference “:det” in taskGroup element and xmlns=http://schemas... in task element. How do I do this? Please see the source xml, xsl, current incorrect output and expected output below. Thank you in advance!

Source XML:
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
  <tasks>
    <task id="{f418cae0-6b68-409b-93f4-a19fa1a5faad}" rank="2" name="1" description="2" tooltip="2" >
      <command type="ShellExecute">
        <arguments>
          <commandLine>www.xxxxxx.com</commandLine>
        </arguments>
      </command>
    </task>
    <task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" >
      <command type="ShellExecute">
        <arguments>
          <commandLine>www.yyyyyy.com</commandLine>
        </arguments>
      </command>
    </task>
  </tasks>
</taskGroup>
...
...
...


XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:det="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks"
>
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
    <taskGroup revocation="false" taskGroupGuid="{{a0949a60-006c-4b35-b334-97ca289b06cd}}"   >
      <xsl:call-template name="taskList"></xsl:call-template>
    </taskGroup>
  </xsl:template>
  <xsl:template name="taskList">
      <xsl:copy-of select="//det:task[@id='{91395410-c164-468c-a247-14bbd7ceea88}']"/>
  </xsl:template>
</xsl:stylesheet>


Current Output (incorrect):
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns:det="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
  <task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
      <command type="ShellExecute">
        <arguments>
          <commandLine>www.yyyyyy.com</commandLine>
        </arguments>
      </command>
    </task>
</taskGroup>


Expected XML Output:
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
  <tasks>
    <task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" >
      <command type="ShellExecute">
        <arguments>
          <commandLine>www.yyyyyy.com</commandLine>
        </arguments>
      </command>
    </task>
  </tasks>
</taskGroup>

AnswerRe: Namespace Parsing Problem Pin
Stuart Dootson24-Sep-09 10:12
professionalStuart Dootson24-Sep-09 10:12 
AnswerRe: Namespace Parsing Problem Pin
sdsuzuki24-Sep-09 17:14
sdsuzuki24-Sep-09 17:14 
GeneralRe: Namespace Parsing Problem Pin
Stuart Dootson25-Sep-09 2:40
professionalStuart Dootson25-Sep-09 2:40 
QuestionTools for merging multiple xsd files Pin
cateyes9922-Sep-09 19:03
cateyes9922-Sep-09 19:03 
AnswerRe: Tools for merging multiple xsd files Pin
Stuart Dootson24-Sep-09 10:04
professionalStuart Dootson24-Sep-09 10:04 
GeneralRe: Tools for merging multiple xsd files Pin
cateyes9924-Sep-09 16:38
cateyes9924-Sep-09 16:38 
AnswerRe: Tools for merging multiple xsd files Pin
Member 248888319-Nov-09 0:30
Member 248888319-Nov-09 0:30 
GeneralRe: Tools for merging multiple xsd files Pin
jepskiluv14-Jan-10 17:30
jepskiluv14-Jan-10 17:30 
GeneralRe: Tools for merging multiple xsd files Pin
cateyes9919-Jan-10 15:14
cateyes9919-Jan-10 15:14 
QuestionUse XML code into MS Word 2007 document Pin
Jim Krueger19-Sep-09 6:28
Jim Krueger19-Sep-09 6:28 
QuestionReading into XML section and getting same value again Pin
Gareth H19-Sep-09 0:41
Gareth H19-Sep-09 0:41 
AnswerRe: Reading into XML section and getting same value again Pin
Stuart Dootson19-Sep-09 22:11
professionalStuart Dootson19-Sep-09 22:11 
AnswerRe: Reading into XML section and getting same value again Pin
Lakhan Pal Garg22-Sep-09 19:08
Lakhan Pal Garg22-Sep-09 19:08 
QuestionXSD problem Pin
gantww18-Sep-09 10:09
gantww18-Sep-09 10:09 
AnswerRe: XSD problem Pin
Stuart Dootson19-Sep-09 22:04
professionalStuart Dootson19-Sep-09 22:04 
Questionsending xml document Pin
aamirzada16-Sep-09 18:31
aamirzada16-Sep-09 18:31 
AnswerVoted to remove message Pin
N a v a n e e t h16-Sep-09 18:45
N a v a n e e t h16-Sep-09 18:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.